为什么我不应该打开“antiJARLocking"?在生产环境中? [英] Why shouldn't i turn on "antiJARLocking" in production environment?

查看:43
本文介绍了为什么我不应该打开“antiJARLocking"?在生产环境中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Tomcat7 服务器上运行 Web 应用程序,但在取消部署它们时遇到问题.Windows 似乎锁定了应用程序文件夹中的特定 JAR 文件.我发现有一个名为antiJARLocking"的上下文属性,我可以将其设置为true"(在此处定义:http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Standard_Implementation) 可以解决问题.

I'm running web-apps on a Tomcat7 server and having trouble undeploying them. It seems that windows keeps a lock on a particular JAR file in the application folder. I've found that there is a context attribute called "antiJARLocking" that i can set to 'true' (defined here: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Standard_Implementation) that may solve the problem.

事实是,我见过一些人说我不应该在生产环境中将此属性设置为 true;但我找不到原因是什么.我知道将此属性设置为 true 可能会减慢 tomcat 启动和/或应用程序启动的速度,但这对我来说听起来不是一个大问题..?我错了吗?

The fact is, i've seen a couple of people stating that i should NOT set this attribute to true in a production environment; but i can't find what are the reasons for that. I know that setting this attribute to true may slow down tomcat startup and/or application startup, but this does not sound like a big problem to me..? Am i wrong?

您是否知道任何其他原因可以解释为什么有些人可能不鼓励在生产中使用antiJARLocking"?JAR 锁定问题还有其他解决方案吗?

Do you know any other reason that would explain why some may discourage the use of "antiJARLocking" in production? Is there any other solution to JAR locking problem?

如果这有任何帮助,我正在运行 tomcat 7.0.40.不断被锁定的jar文件是ojbdc6.jar".

If this can be of any help, i'm running tomcat 7.0.40. The jar file that keeps getting locked is "ojbdc6.jar".

感谢您的帮助!

推荐答案

Tomcat 的反资源锁定功能旨在解决已部署的 Web 应用程序中导致文件打开但未关闭的错误.在某些操作系统(主要是 Windows)上,这可以防止文件被删除,从而防止 Web 应用程序被完全取消部署.通常,删除这些文件的唯一方法是先停止 Tomcat.反资源锁定将 Web 应用程序复制到工作目录中唯一命名的目录,并从那里部署它.每次重新部署都会获得一个新目录,因此无法删除旧目录并不是一个直接的问题.

Tomcat's anti-resource locking features are provided to work around bugs in deployed web applications that result in files being opened but not closed. On some operating systems - primarily Windows - this prevents the file from being deleting which in turn prevents the web application from being fully undeployed. Usually, the only way to delete those files is to stop Tomcat first. The anti-resource locking copies the web application to a uniquely named directory in the work directory and deploys it from a there. Each redployment gets a new directory so not being able to delete the old directory is not an immediate problem.

在生产中不应该使用反资源锁定功能没有具体的原因.但是,您确实需要注意锁定的文件实际上是内存泄漏,并且在多次重新部署后,您可能最终会填充 permGen 并触发 OOME.

There is no specific reason why the anti-resource locking features should not be used in production. However, you do need to be aware that locked files are effectively a memory leak and after multiple redeploys you may end up filling permGen and triggering an OOME.

odbc6.jar 被锁定的快速而肮脏的解决方案是将它从 WEB-INF/lib 移动到 $CATALINA_HOME/lib.更好的解决方案是找出它被锁定的原因(您可能需要结合使用分析器和调试器来查找根本原因)并修复它.

The quick and dirty solution to odbc6.jar being locked is to move it from WEB-INF/lib to $CATALINA_HOME/lib. The better solution is to figure out why it is locked (you'll probably need to use a combination of a profiler and a debugger to find the root cause) and fix it.

这篇关于为什么我不应该打开“antiJARLocking"?在生产环境中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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