码迷,mamicode.com
首页 > 其他好文 > 详细

sun.misc.Unsafe.park(Native Method)

时间:2018-08-30 16:43:28      阅读:896      评论:0      收藏:0      [点我收藏+]

标签:2-2   ppc   apach   []   The   pre   ref   项目   process   

关闭tomcat时或者重启tomcat时 log4j2 报错: sun.misc.Unsafe.park(Native Method)

异常信息:

30-Aug-2018 15:59:34.900 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [] appears to have started a thread named [Thread-14] but has failed to stop it. This is very likely to create a memory leak.
30-Aug-2018 15:59:34.901 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "Thread-14":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

 

 

新项目使用log4j2+springmvc的方式,但是报这个错,查了很多资料,原因是log4j2-2.6开始引入shutdown(),在2.6中,如果web app卸载时没有进行shutdown(),tomcat会发布内存泄漏风险的告警。

在web.xml里加入下边代码块,要放在spring相关配置前边

  <listener>
    <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
  </listener>
  <context-param>
    <param-name>isLog4jAutoInitializationDisabled</param-name>
    <param-value>true</param-value>
  </context-param>

sun.misc.Unsafe.park(Native Method)

标签:2-2   ppc   apach   []   The   pre   ref   项目   process   

原文地址:https://www.cnblogs.com/Ai-Hen-Jiao-zhi/p/9560735.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!