如何通过catalina.out查找tomcat自动关机原因
Posted
技术标签:
【中文标题】如何通过catalina.out查找tomcat自动关机原因【英文标题】:How to find the tomcat automatic shutdown reason by catalina.out 【发布时间】:2016-09-13 20:20:38 【问题描述】:最近,tomcat出现几次自动关机。但通过 catalina.out 找不到原因
服务器:linux(1核cpu,1G内存)
tomcat:7.0.65
tomcat server.xml 添加jvm设置: JAVA_OPTS="-server -Xms256m -Xmx512m -XX:PermSize=256M -XX:MaxPermSize=512m"
catalina.out
2016-05-17 00:31:55 -173311 [http-bio-8080-exec-5] DEBUG - ==> Parameters: 3(String)
2016-05-17 00:31:55 -173313 [http-bio-8080-exec-5] DEBUG - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5503fcfc]
May 17, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
May 17, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
May 17, 2016 2:43:14 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
2016-05-17 02:43:14 -8036625 [localhost-startStop-2] INFO - Closing WebApplicationContext for namespace 'springMvc-servlet': startup date [Tue May 17 00:29:22 CST 2016]; parent: Root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [/legoms] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [/legoms] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [/legoms] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
2016-05-17 02:43:14 -8051975 [localhost-startStop-2] INFO - Closing WebApplicationContext for namespace 'springMvc-servlet': startup date [Tue May 17 00:29:10 CST 2016]; parent: Root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
May 17, 2016 2:43:14 AM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [] created a ThreadLocal with key of type [org.apache.shiro.util.ThreadContext.InheritableThreadLocalMap] (value [org.apache.shiro.util.ThreadContext$InheritableThreadLocalMap@6ae24d54]) and a value of type [java.util.HashMap] (value [org.apache.shiro.util.ThreadContext_SECURITY_MANAGER_KEY=org.apache.shiro.web.mgt.DefaultWebSecurityManager@2f42fc9e, org.apache.shiro.util.ThreadContext_SUBJECT_KEY=org.apache.shiro.web.subject.support.WebDelegatingSubject@56d7014f]) 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.
May 17, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
May 17, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
May 17, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
May 17, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
【问题讨论】:
【参考方案1】:您的 Tomcat 服务器可能关闭的原因是操作系统更新需要您的 JVM 启动(可能是内核更新)。我会首先查看以 yum 开头的操作系统日志或系统正在使用的任何包管理器,以查看是否有任何更新以及服务器停止时它在做什么。
这种情况发生在我身上很多次了。
【讨论】:
谢谢。但是如何找出哪些系统日志文件呢?使用ls -l /var/log/
,不喜欢最近更新日志文件
不应该有太多的日志需要排序,我认为在这种情况下不需要搜索,因为许多系统文件滚动并且您正在寻找特定的日期/时间。例如,在 centos 系统上,您可能有消息、yum.log 和安全文件。以上是关于如何通过catalina.out查找tomcat自动关机原因的主要内容,如果未能解决你的问题,请参考以下文章
linux 下 使用cronolog对Tomcat 输出catalina.out 日志按照自定义日期格式进行切割 亲测可用
为什么Grails(在Tomcat中)记录到catalina.out和我的自定义文件appender?