MyFaces中的内存泄漏

时间:2010-12-02 11:34:56

标签: jsf memory-leaks tomcat6 myfaces

  

编辑:您可以在下面的评论中找到的解决方案假定更改   从MyFaces到JSF的实现   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的内存泄漏与第一个内存有关。

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

1 个答案:

答案 0 :(得分:2)

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

  1. 使用警告消息并等到MyFaces发布修复程序。

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

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