I have a website deployed on an apache web server. I am using a windows installer to deploy and un-deploy this website from the server. During the uninstall I am just removing the .war from the webapp directory of the tomcat. Now when I do this the tomcat automatically removes all the folders created when it unpacked the war file. But it takes some time to remove those folders.

I want to know if there is a way to force tomcat to remove the folder immediately by communicating to it with some external tool eg a script, xml-rpc etc?


This may be due to issues with file and/or jar locking, particularly on Windows. There are two options available on the Context configuration level to minimize the impact of these (antiJARLocking is a subset of antiResourceLocking).

Edit the file in <tomcat-root>/conf/context.xml and modify the <Context> element to include the antiResourceLocking attribute as follows:

<Context antiResourceLocking="true">

For further information regarding context configuration options, have a look in the docs: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

  • I tried this but it is still taking some time before it removes the website folder. What difference this had is very difficult to notice and I am still trying to figure this out. Thanks. – sttaq Apr 4 '12 at 9:06
  • What kind of delay are you experiencing? – simonnordberg Apr 4 '12 at 16:32
  • This time is not fixed. Sometimes it takes seconds and sometimes it takes just under a minute. I was thinking if its possible to invoke tomcat to remove the website folder as soon as we remove the 'war' file. – sttaq Apr 5 '12 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.