本文介绍了MyFaces中的内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MyFaces 2.0.0上确实遇到了令人讨厌的问题(更准确地说,我也在2.0.1和2.0.2上进行了检查,问题仍然存在).

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).

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

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).

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

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.

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

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

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

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

从提供ELFactoryImpl的库中也有连接的内存泄漏:

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 ?

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

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-2942But I don't know what to think about it. Should I wait for version 2.0.3 ?

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

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

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

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

推荐答案

该问题已经得到报告,将得到解决.截至目前,您有3种选择:

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

  1. 实时显示警告消息,并等待MyFaces家伙发布此修复程序.

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

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

Apply the proposed patch in your current MyFaces implementation.

通过 Mojarra (参考实现)替换MyFaces,它不会暴露此问题.

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

这篇关于MyFaces中的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 08:17