Java 从 tomcat 取消部署 Web 应用程序不会删除部署的目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20743916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 04:01:50  来源:igfitidea点击:

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

javatomcatundeploy

提问by Shahe

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 .warfile from the webappsdirectory but the exploded directory doesn't get removed (the WEB-INF/libfolder), neither from the List Applications in the tomcat mananger.

我正在使用 tomcat manager 命令在 tomcat 服务器上部署和取消部署 web 应用程序。问题是当我尝试取消部署 Web 应用程序时,它确实.warwebapps目录中删除了文件,但分解的目录没有被删除(WEB-INF/lib文件夹),也没有从 tomcat 管理器中的列表应用程序中删除。

I am on Windows and I am using Tomcat 6.0.20.

我在 Windows 上,我使用的是 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.

注意:当我尝试手动删除目录时,它给了我一个错误,说该文件正在被另一个程序使用。

采纳答案by Shahe

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

我找到了解决方案,只需将其放入您的context.xml文件中your_tomcat_home_directory/Config

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

Everything works fine.

一切正常。

回答by JeroenVP

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

尝试停止您的Tomcatserver(-service),然后您可以手动删除爆炸目录,然后重新启动它。

回答by Tung

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.

我在 Windows 上使用 cygwin。即使在关闭 tomcat 之后,我也无法删除 web 应用程序文件夹 - 该命令一直返回“设备或资源繁忙”。我注意到即使在我关闭了 tomcat 之后 java 进程仍在运行,所以我决定杀死它,并且能够手动删除 web 应用程序文件夹。