内存泄漏由于xmlbeans 2.6.0.jar

时间:2015-09-30 11:08:28

标签: java xlsx

我尝试为{i} xlsx创建xmlbeans 2.6.0.jar个文件来创建一个项目。当我尝试重新启动glassfish时,我收到以下错误消息。请任何人通过这个并帮助我

Error:
Severe:   The web application [/test] created a ThreadLocal with
key of type [org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$1]  
(value  
[org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$1@4f7c1b38]) and 
a value of type [java.util.ArrayList] (value
[[java.lang.ref.SoftReference@51ec7f5b]]) but failed to remove it when 
the web application was stopped. Threads are going to be renewed over 
time to try and avoid a probable memory leak.

Severe:   The web application [/test] created a ThreadLocal with 
key of type [org.apache.xmlbeans.impl.store.Locale$1] (value 
[org.apache.xmlbeans.impl.store.Locale$1@736da929]) and a value of 
type [java.lang.ref.SoftReference] (value 
[java.lang.ref.SoftReference@60681b99]) but failed to remove it when 
the web application was stopped. Threads are going to be renewed over 
time to try and avoid a probable memory leak.

Severe:   The web application [/test] created a ThreadLocal with 
key of type [org.apache.xmlbeans.XmlBeans$1] (value 
[org.apache.xmlbeans.XmlBeans$1@4fe26977]) and a value of type 
[java.lang.ref.SoftReference] (value 
[java.lang.ref.SoftReference@7d46d177]) but failed to remove it when 
the web application was stopped. Threads are going to be renewed over 
time to try and avoid a probable memory leak.

2 个答案:

答案 0 :(得分:0)

这是a known issue of XML Beans库。

您可以尝试关注 Jochen Kemnade 的建议:

  

作为一种解决方法,我将POI转换移动到专用线程池,当我的webapp上下文被销毁时我关闭了该线程池。这样,所有泄漏都会随着池而下降,并且Tomcat的处理程序线程保持干净

完成内部工作并Executor并摆脱它。

答案 1 :(得分:0)

自从XMLBeans 3.1.0(从Apache POI 4.1.0开始包含)以来,就有一种方法可以从当前线程中手动清除XMLBeans中的所有线程本地变量:

org.apache.xmlbeans.ThreadLocalUtil.clearAllThreadLocals()

请参见https://issues.apache.org/jira/browse/XMLBEANS-502http://xmlbeans.apache.org/status.html