[英]tomcat 7 undeploy fails dues log4j.properties
This error is quite puzzling. 这个错误令人费解。 In my webapps, I have the log4j.properties in WEB-IF/classes as per recommendation. 在我的Web应用程序中,按照建议,我在WEB-IF /类中具有log4j.properties。
When I deploy from eclipse, I do a stop on the webapp, undeploy, and then deploy. 从eclipse部署时,我停止了webapp,取消部署,然后部署。 Strangely enough, 8 out of 10 times I get the following error on undeploy- 奇怪的是,每10次中有8次我在取消部署时收到以下错误-
build.xml:526: FAIL - Unable to delete [C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0\\webapps\\punch]. build.xml:526:失败-无法删除[C:\\ Program Files \\ Apache Software Foundation \\ Tomcat 7.0 \\ webapps \\ punch]。 The continued presence of this file may cause problems. 该文件的继续存在可能会导致问题。
The only file remaining under my webapp is the WEB-INF/classes/log4j.properties. 我的Web应用程序下剩余的唯一文件是WEB-INF / classes / log4j.properties。 Everything else is deleted. 其他所有内容均被删除。
I cannot manually delete the file or the webapp folder either. 我也无法手动删除文件或webapp文件夹。 I have to stop Tomcat service, delete the folder and then restart. 我必须停止Tomcat服务,删除文件夹,然后重新启动。
Is there any solution for this? 有什么解决办法吗?
Thanks. 谢谢。
Here is my remove task in build.xml 这是我在build.xml中的删除任务
<target name="remove"
description="Remove application on servlet container">
<stop url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
<undeploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
Make sure you call LogManager.shutdown() in the contextDestroyed() method of a ServletContextListener. 确保在ServletContextListener的contextDestroyed()方法中调用LogManager.shutdown()。 That should ensure that log4j doesn't have the file open. 那应该确保log4j没有打开文件。
Here is my work around: 这是我的工作范围:
I created another target to copy the war to Tomcat's webapp directory. 我创建了另一个目标,将战争复制到Tomcat的webapp目录。
<target name="copywar" depends="dist">
<copy file="${dist.home}/${app.name}.war" todir="${catalina.home}/webapps" />
</target>
I also made sure that Tomcat could redeploy with this in server.xml 我还确保Tomcat可以在server.xml中重新部署它
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
This works just fine. 这样很好。 Thanks for your help folks. 感谢您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.