I'm new to Tomcat
. We have a dev machine with about 5 apps running. Even though it's dev, it's used by our clients pretty heavily during testing.
So say we need to make one small change on one class file. Right now, we have to shutdown Tomcat (affecting the other four apps), delete the WAR
file (and web app directory), redeploy the new WAR
file and restart Tomcat
.
Of course, this upsets a few people because it destroys all logged in sessions for all apps.
Is there a better way to do this? I mean, is there a way to only reload the CLASS that changed instead of everything on the dev machine?
Thanks.
Restarting the Tomcat server is also a way to stop and restart your applications, which allows elements such as web. xml files to be reloaded (although there are ways of reloading these files without stopping the server).
The webapps directory is where deployed applications reside in Tomcat. The webapps directory is the default deployment location, but this can be configured with the appBase attribute on the <Host> element.
Have you tried to use Tomcat's Manager application? It allows you to undeploy / deploy war files with out shutting Tomcat down.
If you don't want to use the Manager application, you can also delete the war file from the webapps directory, Tomcat will undeploy the application after a short period of time. You can then copy a war file back into the directory, and Tomcat will deploy the war file.
If you are running Tomcat on Windows, you may need to configure your Context to not lock various files.
If you absolutely can't have any downtime, you may want to look at Tomcat 7's Parallel deployments You may deploy multiple versions of a web application with the same context path at the same time. The rules used to match requests to a context version are as follows:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With