Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a .war in Tomcat

Tags:

tomcat

war

I am new to Tomcat and following is the steps I am using to update a .war in Tomcat:

  1. stop tomcat.
  2. delete .war and the folder with same name in /webapps.
  3. copy and paste my new .war in /webapps.
  4. restart tomcat by ./bin/catalina.sh run.

However, the new .war always won't work. Seems it's the old version .war that is running.

In /conf/server.xml, I am using the following configs:

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

Can someone help me on this problem? Thanks!

like image 690
Qiwen Gao Avatar asked Mar 16 '16 09:03

Qiwen Gao


People also ask

Where do I put WAR file in Tomcat?

Perhaps the simplest way to deploy a WAR file to Tomcat is to copy the file to Tomcat's webapps directory. Copy and paste WAR files into Tomcat's webapps directory to deploy them. Tomcat monitors this webapps directory for changes, and if it finds a new file there, it will attempt to deploy it.


1 Answers

Replacing the old war file with a new one should work fine. You don't need to delete the old one, just overwrite it.

If you don't want to restart the server you could set <Context reloadable="true"> in context.xml file.

Better yet, I'd suggest you use Tomcat Manager to deploy without shutting down Tomcat. Hope this helps.

like image 103
Diyarbakir Avatar answered Nov 25 '22 18:11

Diyarbakir