Undeploy web application from tomcat doesn't remove the deployed directory
Asked Answered
E

3

7

I am using tomcat manager commands to deploy and undeploy web applications on a tomcat server. The problem is when I try to undeploy a web application, it does remove the .war file from the webapps directory but the exploded directory doesn't get removed (the WEB-INF/lib folder), neither from the List Applications in the tomcat mananger.

I am on Windows and I am using Tomcat 6.0.20.

Note: When I tried to delete the directory manually it gave me an error saying that the file is being used by another program.

Electrocautery answered 23/12, 2013 at 12:46 Comment(0)
E
15

I found the solution, just put this in your context.xml file in your_tomcat_home_directory/Config:

<Context antiJARLocking="true" antiResourceLocking="true">

Everything works fine.

Electrocautery answered 24/12, 2013 at 8:2 Comment(3)
the docs say: antiJARLocking is a subset of antiResourceLocking and therefore, to prevent duplicate work and possible issues, only one of these attributes should be set to true at any one timeMaleficence
Becareful, the output of ctx.getRealPath("/") will changeCourteous
@Maleficence As abl stated, as the answer it is, Tomcat 11 not staring. Only <Context antiResourceLocking="true" > was enough for me.Courteous
T
0

Try to stop your Tomcatserver(-service), then you can manually delete the exploded directory, then restart it agian.

Toxinantitoxin answered 23/12, 2013 at 12:48 Comment(1)
I can't stop the tomcat service, it should be done on the fly, there are other applications running and I can't just stop them.Electrocautery
M
0

I was on Windows using cygwin. Even after shutting down tomcat, I could not delete the web application folder - the command kept on returning "Device or resource busy". I noticed that the java process was still running even after I had shut down tomcat so I decided to kill it, and was able to manually delete the web application folder.

Mistaken answered 30/3, 2016 at 0:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.