CXF 3内存泄漏

时间:2015-06-11 19:54:19

标签: jaxb cxf

我有一个从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.

1 个答案:

答案 0 :(得分:0)

这似乎是known limitation of the JAXB API。问题声明你可以通过明确关闭Unmarshaller来避免这个问题,但我自己没有尝试过。