Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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:

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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