简体   繁体   English

Tomcat取消部署不会删除Web应用程序工件

[英]Tomcat undeploy does not remove web application artifacts

How do I get Tomcat to remove the web application artifacts when using the Manager to undeploy the application? 在使用Manager取消部署应用程序时,如何让Tomcat删除Web应用程序工件?

I am using Tomcat 6.0.18. 我正在使用Tomcat 6.0.18。 The application was deployed using the tomcat-maven-plugin 1.0-SNAPSHOT but the behavior is the same through the maven plugin or the web interface. 使用tomcat-maven-plugin 1.0-SNAPSHOT部署应用程序,但是通过maven插件或Web界面的行为是相同的。

The Tomcat documentation provides warnings on how undeploy should behave on the Manager How To . Tomcat文档提供有关取消部署应如何Manager How To上执行操作的警告。

The war file can be removed; war文件可以删除; however, the unpacked application directory remains preventing a redeploy. 但是,解压缩的应用程序目录仍然阻止重新部署。

It may also be an issue with file locking (particularly on Windows) if you are accessing resources in a JAR library via a URL within your app. 如果您通过应用程序中的URL访问JAR库中的资源,那么它也可能是文件锁定的问题(特别是在Windows上)。

I just had a similar issue and fixed it by modifying the following line in the 我只是有一个类似的问题,并通过修改以下行修复它

Apache Tomcat/conf/context.xml Apache Tomcat / conf / context.xml

file to: 档案:

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

(Note that there is some contention as to whether this is production safe since it creates copies of your webapp for each redeploy, but if you're on Windows and you can't fix the issue at the source, then this may provide a workable solution). (请注意,这是否是生产安全的争论,因为它为每次重新部署创建了webapp的副本,但如果您使用的是Windows并且无法在源处修复问题,那么这可能会提供可行的方法。解)。

It might be that your application cannot completely be undeployed because there are background threads (that you most likely started yourself) or long running requests that are preventing the application to stop completely. 可能是您的应用程序无法完全取消部署,因为有后台线程(您最有可能自己开始)或长时间运行的请求阻止应用程序完全停止。

Did you inspect the log files? 你检查过日志文件了吗? Did they state if the application could be undeployed successfully? 他们是否说明应用程序是否可以成功取消部署? Or the opposite? 或者相反? Can you get a Thread dump after you attempted to undeploy (kill -3 processid on Unix, Ctrl-Break in a console in Windows) and see if there is something still running that shouldn't? 在尝试取消部署(在Unix上杀死-3 processid,在Windows中的控制台中按Ctrl-Break)并查看是否还有正在运行的内容时,是否可以获得线程转储?

Also note that most applications I've seen cannot be undeployed completely with regard to the memory they took. 另请注意,我看过的大多数应用程序都无法完全取消部署它们所占用的内存。 I've run into OutOfMemoryErrors (PermGen) quite often, especially after redeploying webapps (you'll find a lot of references on PermGen if you google for it) therefor I believe redeploying is ok for development machines, but not for production ones. 我经常遇到OutOfMemoryErrors(PermGen),特别是在重新部署webapps之后(如果你谷歌的话,你会发现很多关于PermGen的引用)因此我认为重新部署对开发机器来说是好的,但不适用于生产机器。 It's better to know this before you're puzzled by this in production. 在你对生产中的这种困惑感到困惑之前,最好先了解这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM