Deploy Java Servlet app locally on Tomcat

How to deploy a Servlet app on tomcat

The thing to do is simple, but surprisingly, even though I read various articles, I didn't write the important part, and I had a headache, so I wrote it as a memorandum.

1. Preparation

Export your Servlet app from Eclipse etc. in war file format

From Eclipse, right-click and select Export> Export in War format, and export to any directory in war file format.

スクリーンショット 2020-07-18 12.29.00.png

b. Installing tomcat

These are not needed if you originally started Tomcat from Eclipse and are trying it on your local server, but if you don't have them you will need to install them.

Install it on your PC with a zip file etc. from this site. http://tomcat.apache.org/download-80.cgi

In the case of Windows, the installation file seems to be different according to the number of bits, so please install the one that suits your environment. (For Mac, you can download the zip file.)

スクリーンショット 2020-07-18 12.59.51.png

c. Unzip the installed files

Open the downloaded file and go to the webapps file.

The contents of the file are as follows. From here go to web apps.

スクリーンショット 2020-07-18 13.02.44.png

Place the war file exported in a in this webapps directory.

d. Change tomcat permissions

After that, I start the shell file or batch file in the installed Tomcat folder, but the permission is 644 by default and it may not be able to start, so in that case change it with the following command.

$ cd /Applications/apache-tomcat-8.5.57
$ chmod 755 *.sh

2. Start tomcat

Start the tomcat shell file with the following command.

$ ./startup.sh

Then, the war file in the webapps directory will be compiled and the file with the same name will be created under webapps.

https://localhost:8080/app名

If successful, you will be able to access it from this URL.

To exit, enter the following command.

$ ./shutdown.sh

Recommended Posts

Deploy Java Servlet app locally on Tomcat
How to deploy a simple Java Servlet app on Heroku
Deploy a Java web app on Heroku
How to deploy a kotlin (java) app on AWS fargate
Run tomcat shell script on java8
Deploy your Rails app on Heroku
Launch Servlet + Tomcat locally on Macbook Pro (text editor + terminal only)
Deploy Java programs on SAP Cloud Platform
Build Apache + Tomcat + Pebble locally on Mac
[Java] Servlet filter
Deploy Java web app to Azure with maven
JSP on tomcat
Install Java, Apache, Tomcat9 on EC2 (Amazon Linux2)
Create a Java Servlet and JSP WAR file to deploy to Apache Tomcat 9 in Gradle
Change Java heap size in Tomcat in Azure App Service
Deploy the Spring Boot project to Tomcat on XAMPP
Rock-paper-scissors app in Java
Install Java on Mac
Tomcat v8 on CentOS7
About [servlet] [JSP] [tomcat]
Run PostgreSQL on Java
Java app performance tuning
Deploy RAILS on EC2
Java Servlet LifeCycle Example
1002 error on tomcat + webSocket
[Java] Deploy the Spring Boot application to Azure App Service