今天上线之后,由于程序有点儿问题,更改了一下,还没等重启tomcat服务,尼玛网站就打不开了,网站首页显示一个502的页面,手机立马收到了报警短信。
1).首先检查日志,查看这段儿时间的tomcat日志,报错如下:
Sep 15, 2015 12:31:06 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak.
Sep 15, 2015 12:31:06 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4395ca0e]) and a value of type [com.ibatis.sqlmap.engine.mapping.result.ResultObjectFactoryUtil.FactorySettings] (value [com.ibatis.sqlmap.engine.mapping.result.ResultObjectFactoryUtil$FactorySettings@566edb2a]) 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.
Sep 15, 2015 12:31:06 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 一直都是报这几行错误,知道代码更新正确之后,经过我的各种baidu、google,终于知道了问题的原因。
问题出现的原因:
自定义tomcat默认web路径的时候,开启了自动部署功能,自动加载了更新的class程序文件导致的。
解决办法:
vim打开server.xml这个文件,找到这一行