在tomcat(版本6.0.33)的 catalina.out中發現大量memory leak的日誌 java
org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap web
SEVERE: The web application [] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@2618d45f]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@51dce88]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. apache
這個是因爲tomcat6.0.24之後的版本有加一個監控memory leak的listener 在tomcathome/conf/server.xml tomcat
<!-- Prevent memory leaks due to use of particular java/javax APIs--> app
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> spa
可是這個監控有bug才致使的誤報 日誌
解決方式任選一種 1 把tomcat降級爲6.0.24如下的版本 server
2 將tomcat升級爲7.0.6以上的版本 xml
3 在server.xml中去掉JreMemoryLeakPreventionListener的listener rem