我有一个从wsdl创建的web服务,并且没有更改任何内容,因此我所拥有的只是一个空应用程序。
在部署应用程序后,只要我点击“停止”(即我甚至没有调用它),我就收到来自Tomcat的“严重”消息,泄漏测试报告我的应用程序有多个实例,并且每次我停止/启动时都会增加。
我使用的是CXF 3.1.0,甚至还尝试下载了最新的JAXB (网站上的参考实现)。
错误如下:
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(Automati
cWorkQueueImpl.java:353)
java.lang.Thread.run(Thread.java:722)
11-Jun-2015 15:45:33.142 SEVERE [http-nio-8080-exec-2] org.apache.catalina.loade
r.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [MyAcces
sAPSServiceN] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassF
actory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@27765bfc]) and a value of t
ype [java.util.WeakHashMap] (value [{class org.apache.cxf.ws.addressing.Attribut
edURIType=java.lang.ref.WeakReference@4b9111a1}]) but failed to remove it when t
he web application was stopped. Threads are going to be renewed over time to try
and avoid a probable memory leak.
11-Jun-2015 15:45:33.143 SEVERE [http-nio-8080-exec-2] org.apache.catalina.loade
r.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [MyAcces
sAPSServiceN] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassF
actory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@27765bfc]) and a value of t
ype [java.util.WeakHashMap] (value [{class org.apache.cxf.ws.discovery.wsdl.Hell
oType=java.lang.ref.WeakReference@211c87c9, class javax.xml.ws.wsaddressing.W3CE
ndpointReference$Address=java.lang.ref.WeakReference@5816ae1a, class javax.xml.w
s.wsaddressing.W3CEndpointReference=java.lang.ref.WeakReference@39005a24, class
org.apache.cxf.ws.discovery.wsdl.ScopesType=java.lang.ref.WeakReference@461e0eb8
, class java.util.ArrayList=java.lang.ref.WeakReference@5f5875fe, class javax.xm
l.ws.wsaddressing.W3CEndpointReference$Elements=java.lang.ref.WeakReference@28aa
a799}]) but failed to remove it when the web application was stopped. Threads ar
e going to be renewed over time to try and avoid a probable memory leak.
11-Jun-2015 15:45:33.146 SEVERE [http-nio-8080-exec-2] org.apache.catalina.loade
r.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [MyAcces
sAPSServiceN] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassF
actory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@27765bfc]) and a value of t
ype [java.util.WeakHashMap] (value [{class org.apache.cxf.ws.addressing.Attribut
edURIType=java.lang.ref.WeakReference@5be142aa}]) but failed to remove it when t
he web application was stopped. Threads are going to be renewed over time to try
and avoid a probable memory leak.
11-Jun-2015 15:45:33.148 SEVERE [http-nio-8080-exec-2] org.apache.catalina.loade
r.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [MyAcces
sAPSServiceN] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassF
actory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@27765bfc]) and a value of t
ype [java.util.WeakHashMap] (value [{class javax.xml.ws.wsaddressing.W3CEndpoint
Reference$Address=java.lang.ref.WeakReference@21dfd606, class javax.xml.ws.wsadd
ressing.W3CEndpointReference=java.lang.ref.WeakReference@6e5c3549, class org.apa
che.cxf.ws.discovery.wsdl.ScopesType=java.lang.ref.WeakReference@67ae8439, class
java.util.ArrayList=java.lang.ref.WeakReference@726aef5c, class org.apache.cxf.
ws.discovery.wsdl.ByeType=java.lang.ref.WeakReference@4a88bbb3, class javax.xml.
ws.wsaddressing.W3CEndpointReference$Elements=java.lang.ref.WeakReference@56db0a
ff}]) 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.发布于 2015-06-19 04:23:35
这似乎是一个known limitation of the JAXB API。Issue声称你可以通过显式关闭Unmarshaller来避免这个问题,但我自己还没有尝试过。
https://stackoverflow.com/questions/30790217
复制相似问题