FreeKB - How to deploy a war application in Tomcat
How to deploy a war application in Tomcat

Home > Search > How-to


Check your <tomcat_home>/conf/server.xml file to determine how a WAR will be deployed. In this example server.xml file, WAR files placed in the <tomcat home>/webapps directory will automatically be deployed and unpacked.

<Host appBase="webapps"
      autoDeploy="true"
      deployOnStartup="true"
      deployXML="true"
      name="localhost"
      unpackWARs="true">

 

After placing a WAR in the webapps directory, wait a few moments, and the WAR should automatically be unpacked and deployed. In this example, myApp.war has been unpacked into the myApp directory. When the WAR file is placed in the webapps directory, the date and time of the WAR file should reflect the current date and time. When the WAR is unpacked, the WAR file directory should be updated to have the current date and time.

~]# ll /opt/tomcat/webapps/
drwxr-x---. 4 root root   51 Jul 4  10:14 myApp
-rwxr--r--. 4 root root 2122 Jul 4  10:14 myApp.war
drwx------. 4 root root   51 Jul 4  10:14 ROOT

 

There will also be an event in catalina.log for the deploy.

Apr 04, 2018 8:00:42 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /opt/tomcat/profiles/myJVM/webapps/myApp.war

Apr 04, 2018 8:00:59 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /opt/tomcat/profiles/myJVM/webapps/myApp.war has finished in 15,040 ms

 


Accessing your application

In the prior examples, an application named MyWebApp was deployed. This application can be accessed by navigating to http://www.example.com:8080/MyWebApp.

 

If the name of the WAR contains the # character, such as apps#sample.war, the URL will then be http://www.example.com:8080/apps/sample.

 


GUI

  1. Sign into your Tomcat Manager App.
  2. Click Browse, select your .war file, and click Deploy.

 

  1. OK should be displayed, and your Application should be listed.

 

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 12480 in the box below so that we can be sure you are a human.




Comments