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.
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: