3

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

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

4

1 回答 1

2

该问题已被报告并将修复。到目前为止,您有 3 个选项:

  1. 忍受警告信息,等到 MyFaces 的人发布修复程序。

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

  3. 用Mojarra (参考实现)替换 MyFaces,它不会暴露这个问题。

于 2010-12-02T11:45:03.537 回答