File locking in Windows may prevent the directory from being deleted.
File locking on Windows is different than file locking on Unix in that on Windows a file can be locked on read. If you are redeploying a second version of an already deployed web application, you may see something like the following web application:
webapps
- myapp.war
- myapp
If myapp.war version 2 were then hot deployed, Tomcat will first try to delete the 'myapp' directory. This will fail if any file is being read there, such as a JAR file. So what happens is that everything except WEB-INF/<parts> gets deleted.
To the user this may seem as the expanding of the new war file failed, but it was the deletion of the old directory that failed.
For hot deploying on Windows, there are two flags antiJARLocking and antiResourceLocking that can be used to mitigate these scenarios. There is more information on these flags at http://tomcat.apache.org/tomcat-6.0-doc/config/context.html.
NOTE: Locked JARs are usually a result of library or application bugs and also represent memory leaks. In addition to this workaround, those areas should be investigated. Tomcat 6.0.24 onwards includes memory leak protection and detection to mitigate some of the common causes of these memory leaks, so an upgrade may be advisable.
Popular Links
Comments
Post new comment