jump to navigation

Avoiding jar locks with Tomcat 6 on Windows Server 2003 December 7, 2007

Posted by maxmil in : tomcat , trackback

I was having problems with a production tomcat 6 server on a Windows Server 2003 box.

If you update the war for a reloadable context while tomcat is running tomcat automatically tries to undeploy the current webapp and redeploy the new war.

On my Windows Server 2003 tomcat could not manage to undeploy the current application because the operating system had a lock on the jar files in WEB-INF/lib.

This left the application partially undeployed and broken.

The only solution was to stop the Tomcat service, manually delete the jar files and restart it which automatically redeploys the webapp.

The problem with this is that this is a production server with multiple webapps installed on it. I didn’t want to have to stop and start the server every time i needed to update just one of my webapps.

The solution has been to add antiJARLocking="true" to the context declaration in tomcat.

There is another option antiResourceLocking="true" which i have also added just to be on the safe side although i don’t think that in my case it’s necessary.


1. blackcat - December 3, 2009

thanks! it works for me, but…
I have 2 locked jars )) one of them was removed and other not. Maybe you have any ideas?