How to update a Tomcat web application without restarting the entire service?

I am new to Tomcat . We have a dev machine with 5 applications. Despite the fact that this is dev, it was very often used by our customers during testing.

So, let's say we need to make a small change to one class file. Right now, we need to close Tomcat (affecting the other four applications), delete the WAR file (and the web application directory), redeploy the new WAR file, and restart Tomcat .

Of course, this upsets a few people because it destroys all registered sessions for all applications.

Is there a better way to do this? I mean, is there a way to reload CLASS that has changed instead of everything on dev machine?

Thank.

+75
tomcat deployment war
Jul 05 2018-11-11T00:
source share
4 answers

Have you tried using the Tomcat Manager app ? This allows you to expand / expand military files without closing Tomcat.

If you do not want to use the Manager application, you can also delete the war file from the webapps directory, Tomcat will immediately delete the application. You can then copy the war file back to the directory, and Tomcat will deploy the war file.

If you use Tomcat on Windows, you may need to configure your Context so as not to block various files.

If you absolutely have no downtime, you can watch Tomcat 7 Parallel Deployments You can deploy multiple versions of an application website with the same content at the same time. The rules used to map queries to the context version are as follows:

  • If the request does not have session information, use the latest version.
  • If the request contains session information, check the session manager of each version for the corresponding session, and if it is found, use this version.
  • If session information is present in the request but no matching session was found, use the latest version.
+47
Jul 05 2018-11-11T00:
source share

In the apache tomcat conf directory, you can find the context.xml file. In this edit tag as < Context reloadable = "true" >. this should fix the problem and you do not need to restart the server

+18
Jul 16 '14 at 18:02
source share

There are several easy ways.

  • Just tap web.xml of any webapp.

     touch /usr/share/tomcat/webapps/<WEBAPP-NAME>/WEB-INF/web.xml 

You can also update a specific jar file in WEB-INF / lib and then touch web.xml instead of creating the entire war file and deploying it again.

  1. Delete the webapps / YOUR_WEB_APP directory, Tomcat will start deploying the war within 5 seconds (if your war file still exists in the webapps folder).

  2. Generally overwriting a war file with a new version is automatically translated by tomcat. If not, you can touch web.xml as described above.

  3. Copy through the already exploded "directory" to your web port folder.

+14
Sep 03 '15 at 5:05
source share
+3
Jul 05 2018-11-11T00:
source share



All Articles