When I undeploy my application from Tomcat, I see below errors in Tomcat logs. What could be the issue? How I should fix this issue.
----------------------------Tomcat log ---------------------------
SEVERE: The web application [/dfsmonitor] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@6ca32e]) and a value of type [com.sun.xml.stream.XMLReaderImpl] (value [com.sun.xml.stream.XMLReaderImpl@e01430]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Jul 1, 2012 10:18:20 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: Unable to determine string representation of value of type [com.sun.xml.stream.writers.XMLStreamWriterImpl]
java.lang.UnsupportedOperationException
at com.sun.xml.stream.writers.XMLStreamWriterImpl.entrySet(XMLStreamWriterImpl.java:2134)
at java.util.AbstractMap.toString(AbstractMap.java:478)
at org.apache.catalina.loader.WebappClassLoader.clearThreadLocalMap(WebappClassLoader.java:2433)
at org.apache.catalina.loader.WebappClassLoader.clearReferencesThreadLocals(WebappClassLoader.java:2349)
at org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1921)
at org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1833)
at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:740)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4913)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:932)
at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1357)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1328)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1094)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1106)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468)
at org.apache.catalina.core.StandardService.stop(StandardService.java:604)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:662)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jul 1, 2012 10:18:20 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/dfsmonitor] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1bf8785]) and a value of type [com.sun.xml.stream.writers.XMLStreamWriterImpl] (value [Unknown]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Jul 1, 2012 10:18:20 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Please let me know what could be the issue.
You could avoid placing XMLStreamWriterImpl instances into thread locals, that way upon shutdown Tomcat wouldn't have any issues removing them.
But other than actually implementing the destroy method on a Servlet, or registering shutdown hooks in an environment such as Spring and tracking all the values you've ever set into threadlocals just so you can remove them upon shutdown, I don't think you really need to worry about this. Though it is odd that you, or code you're using, is storing this value into a threadlocal - typically stream writers are created and destroyed quickly and don't persist very long.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With