当我在tomcat中重新部署我的应用程序时,我遇到以下问题:
The web application [] created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@10d16b])
and a value of type [com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty]
(value [com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty@1a183d2]) but
failed to remove it when the web application was stopped.
This is very likely to create a memory leak.
Run Code Online (Sandbox Code Playgroud)
另外,我在我的应用程序中使用ehcache.这似乎也导致以下异常.
SEVERE: The web application [] created a ThreadLocal with key of type [null]
(value [com.sun.xml.bind.v2.ClassFactory$1@24cdc7]) and a value of type [java
.util.WeakHashMap...
Run Code Online (Sandbox Code Playgroud)
ehcache似乎创建了一个弱哈希映射,我得到的消息是,这很可能会造成内存泄漏.
我在网上搜索并发现了这个, http://jira.pentaho.com/browse/PRD-3616但是我没有这样的服务器访问权限.
如果这些警告有任何功能影响或是否可以忽略,请告诉我?我在tomcat管理器中使用了"查找内存泄漏"选项,它说"没有发现内存泄漏"
每当我停止或重新部署webapp时,我都会看到很多类似的错误,
msg=The web application [] created a ThreadLocal with key of type [] (value []) and
a value of type [] (value []) but failed to remove it when the web application was
stopped. Threads are going to be renewed over time to try and avoid probable memory leak
Run Code Online (Sandbox Code Playgroud)
我不是在我的应用程序中创建任何ThreadLocals,而是引用可能正在创建这些ThreadLocals的许多库.我们目前正在使用Tomcat 7.我已经遇到过其他类似的问题[在Tomcat中重新部署应用程序时内存泄漏或catalina.out中的这些警告是什么?]但是所有这些只是暗示这是Tomcat功能警告你ThreadLocals没有被删除.我没有看到删除ThreadLocals的任何答案.我也看到一些关于线程没有停止的错误,
msg=The web application [] appears to have started a thread named [] but has
failed to stop it. This is very likely to create a …Run Code Online (Sandbox Code Playgroud) 我尝试部署我的war文件.
但成功部署后.
我得到这个日志:
[root@dfdfdf bin]# export JAVA_HOME="/usr/java/jdk1.8.0_112/"
[root@dfdfdfdbin]# ./startup.sh
Using CATALINA_BASE: /root/apache-tomcat-8.5.8
Using CATALINA_HOME: /root/apache-tomcat-8.5.8
Using CATALINA_TMPDIR: /root/apache-tomcat-8.5.8/temp
Using JRE_HOME: /usr/java/jdk1.8.0_112/
Using CLASSPATH: /root/apache-tomcat-8.5.8/bin/bootstrap.jar:/root/apache-tomcat-8.5.8/bin/tomcat-juli.jar
Tomcat started.
[root@satubangau bin]# tail -f ../logs/catalina.out
06-Feb-2017 07:21:27.881 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Request attributes]) and a value of type [org.grails.web.servlet.mvc.GrailsWebRequest] (value [ServletWebRequest: uri=/error]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to …Run Code Online (Sandbox Code Playgroud)