WAR Files Not Completely Extracted on Deployment on Windows

posted by SpringSource on May 26, 2010 07:15 AM

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:

- 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  

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.

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.


Post new comment

This question is for testing whether you are a human visitor and to prevent automated spam submissions.