当插入新的war文件时,Tomcat webapp文件夹被破坏 [英] Tomcat webapp folder is ruined when putting a new war file

查看:118
本文介绍了当插入新的war文件时,Tomcat webapp文件夹被破坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,当我在Tomcat的webapps文件夹中添加一个更新的war文件时,相应的webapp会自动更新。



但是有时候,当我更新一个war文件时,发生一个奇怪的事情:除了一些随机的文件集合外,大部分webapp的文件夹被删除。在这种情况下,webapp不再有效。为了使其工作,我必须停止Tomcat,完全删除该webapp的文件夹,然后重新启动Tomcat。



我尝试从Tomcat管理器中停止webapp,然后再放入在webapps中的war文件 - 这没有帮助。



我试图将autodeploy和/或unpackwars更改为false,但是webapp没有被更新所有的时候我把新的warfile。



我也试图使用Jenkins的部署插件,但同样的问题发生。


$ b $

解决方案

根据Tomcat 7配置指南: http://tomcat.apache.org/tomcat-7.0-doc/ config / host.html#自动%20Application%20部署


更新 WAR文件将触发应用程序的取消部署,
删除任何一个关联扩展目录,上下文文件和
工作目录。任何当前的用户会话将不会被保留...
应用程序将在下次自动部署程序检查
进行更改时重新部署。


可能的问题是,自动部署者仍然没有完成删除扩展目录,而另一个线程开始重新部署它。



我的解决方法是删除旧的war文件,等到目录被删除,然后才能放入新的war文件,因为:


删除 WAR文件将触发应用程序的取消部署,
删除任何关联的扩展目录,上下文文件和
工作目录。任何当前的用户会话都不会被持久化。



Usually, when I put an updated war file in Tomcat's webapps folder, the appropriate webapp is automatically updated.

But sometimes, when I put an updated war file, a strange thing happens: most of that webapp's folder is deleted, except some random collection of files. Of course in this case the webapp no longer works. To make it work, I must stop Tomcat, delete the folder of that webapp entirely, then restart Tomcat.

I tried to stop the webapp from the Tomcat manager before putting the war file in webapps - it didn't help.

I tried to change "autodeploy" and/or "unpackwars" to false, but then the webapp was not updated at all when I put the new warfile.

I also tried to use Jenkins' deployment plugin, but the same problem happened.

System spec: Tomcat 7 on Windows 2003.

解决方案

According to Tomcat 7 configuration guide: http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Automatic%20Application%20Deployment

"Updating a WAR file will trigger an undeploy of the application, with the removal of any associated expanded directory, context file and work directory. Any current user sessions will not be persisted... The application will be redeployed the next time the auto deployer checks for changes."

Probably, the problem is that the auto-deployer still hasn't finished to remove the expanded directory, while another thread started re-deploying it.

My workaround is to delete the old war-file, wait until the directory is removed, and only then put the new war-file, since:

"Deleting a WAR file will trigger an undeploy of the application, with the removal of any associated expanded directory, context file and work directory. Any current user sessions will not be persisted."

这篇关于当插入新的war文件时,Tomcat webapp文件夹被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆