Saturday, January 27, 2007

Tomcat Hot Deployment in Windows

The post about hot deploying an application to Tomcat using maven brought me a problem: the struts.jar was always left in the WEB-INF/lib of the exploded directory in the server.

This is a know issue with Tomcat working under Windows and I found an article which I quoted here below with the solution for this problem:

If you try to hot-deploy a WAR file to Tomcat on Windows, you often encounter file locking issues. Windows won’t let Tomcat undeploy the old app because files are locked by the OS. Here is a fix:

Edit %CATALINA_HOME%\conf\context.xml. Find the root <context> and add these two attributes:

<context antijarlocking="true" antiresourcelocking="true">

Now you can copy updated WAR files to your deploy directory and Tomcat will remove the old app and hot-deploy your new app. I’m using this on Tomcat 5.5.11 without any trouble.

There were other people having this kind of problem. Please note that this has nothing to do with using Maven, but with the combination of Tomcat 5.5 + Windows and Hot Deploys! :)

1 comment:

Anonymous said...

Hi Daniel. Right now u r my hero! I have been struggling with this issue for many days and finally found your post. Having 2 stop/start tomcat and manually delete deployed directories was *really* hindering my progress.

thx so much for the post!

Kevin