MyFaces 中的内存泄漏

发布于 2024-10-05 19:20:02 字数 2609 浏览 1 评论 0原文

编辑:您可以在下面的评论中找到的解决方案假设更改 JSF 实现从 MyFaces 到 Sun 的 Mojarra。

嗨,

我在 MyFaces 2.0.0 上遇到了非常烦人的问题(更准确地说,我也在 2.0.1 和 2.0.2 上检查过它,问题仍然存在)。

我现在正在 MyFaces 下编写应用程序。简而言之,在我的应用程序中我使用框架:Spring、Hibernate、JSF(MyFaces 实现) 我的应用程序容器是Tomcat(6.0.29版本) 我使用maven来构建和部署(版本3.0)。

问题是当我尝试通过 maven (mvn tomcat:redeploy) 重新部署应用程序时,它首先尝试取消部署应用程序并再次部署它。但取消部署从未成功。我得到信息:

SEVERE: The web application [/adam] created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4b0a4d7c]) and a value of type
[org.apache.myfaces.config.RuntimeConfig] (value  org.apache.myfaces.config.RuntimeConfig@11652e61])
but failed to remove it when the web application was stopped.
This is very likely to create a memory leak.

由于此错误,tomcat 无法取消部署应用程序:

INFO: Undeploying context [/adam]
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar delete
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:49 org.apache.catalina.startup.HostConfig deployDirectory

WEB-INF\lib 中的所有库以及保存 Log4J 日志的文件无法删除。

提供 ELFactoryImpl 的库还存在连接的内存泄漏:

SEVERE: The web application [/adam] created a ThreadLocal with key of type [null]
(value [org.apache.myfaces.el.convert.VariableResolverToELResolver$1@693985fc])
and a value of type [java.util.HashSet] (value [[]]) but failed to remove it
when the web application was stopped.
This is very likely to create a memory leak.

如何消除这种内存泄漏?

我一直在寻找答案很长时间我找不到任何解决方案。 我在 myface 的 jira 上发现了这个问题: https://issues.apache.org/jira/browse /MYFACES-2942 但我不知道该怎么想。我应该等待 2.0.3 版本吗?

我认为 EL 的内存泄漏与第一个有关。

请帮我 ! ;) 如果需要,我可以提供更多详细信息。

EDIT: The solution that you can find in comments below assumes changing
JSF implemenetation from MyFaces to
Sun's Mojarra.

Hi,

I have got really annoying problem with MyFaces 2.0.0 (To be more precisely I checked it out also on 2.0.1 and 2.0.2 and problem remains).

I'm writing now application under MyFaces. Briefly speaking in my application i use frameworks: Spring, Hibernate, JSF (MyFaces implementation)
My application container is Tomcat (6.0.29 version)
I use maven to build and deploy (version 3.0).

The problem is when I try to redeploy application via maven (mvn tomcat:redeploy) it tries first to undeploy application and the deploy it again. But undeploying never suceed. I've got information:

SEVERE: The web application [/adam] created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4b0a4d7c]) and a value of type
[org.apache.myfaces.config.RuntimeConfig] (value  org.apache.myfaces.config.RuntimeConfig@11652e61])
but failed to remove it when the web application was stopped.
This is very likely to create a memory leak.

Due to this error tomcat cannot undeploy application:

INFO: Undeploying context [/adam]
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar delete
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:49 org.apache.catalina.startup.HostConfig deployDirectory

All of my libraries in WEB-INF\lib and my file where i keep logs from Log4J cannot be deleted.

There is also connected memory leak from library that provides ELFactoryImpl:

SEVERE: The web application [/adam] created a ThreadLocal with key of type [null]
(value [org.apache.myfaces.el.convert.VariableResolverToELResolver$1@693985fc])
and a value of type [java.util.HashSet] (value [[]]) but failed to remove it
when the web application was stopped.
This is very likely to create a memory leak.

How to get rid of this memory leaks ?

I have been looking for answer really long I cannot find any solution.
I found this issue on myface's jira: https://issues.apache.org/jira/browse/MYFACES-2942
But I don't know what to think about it. Should I wait for version 2.0.3 ?

I think that memory leak from EL is connected to first one.

Please, help me ! ;) I can provide more details if needed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笙痞 2024-10-12 19:20:02

该问题已被报告并将得到修复。截至目前,您有 3 个选择:

  1. 接受警告消息并等待 MyFaces 人员发布修复程序。

  2. 在当前的 MyFaces 实现中应用建议的补丁。

  3. 将 MyFaces 替换为 Mojarra (参考实现),这样就不会暴露此问题。

The problem has already been reported and will be fixed. As of now you have 3 options:

  1. Live with the warning message and wait until MyFaces guys release the fix.

  2. Apply the proposed patch in your current MyFaces implementation.

  3. Replace MyFaces by Mojarra (the reference implementation) which doesn't expose this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文