标签:tomcat
应用部署上之后无法正常启动,tomcat启动日志如下:
信息: Starting service Catalina
2015-7-22 18:39:31 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.36
2015-7-22 18:39:31 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory cdr
2015-7-22 18:39:31 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(/cdr/webserver/CDR2.0/webapps/cdr/WEB-INF/lib/javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2015-7-22 18:39:34 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2015-7-22 18:39:34 org.apache.catalina.core.StandardContext start
严重: Context [/cdr] startup failed due to previous errors
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/cdr] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/cdr] 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.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [FileWatchdog] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-5] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-1] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 18:39:34 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 18:39:34 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2015-7-22 18:39:34 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:9090
2015-7-22 18:39:34 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/11 config=null
2015-7-22 18:39:34 org.apache.catalina.startup.Catalina start
信息: Server startup in 3280 ms
开始以为是jar包冲突,删除javaee.jar包解决了jar包冲突问题,启动依然报错,日志信息如下:
2015-7-22 19:34:23 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2015-7-22 19:34:23 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.36
2015-7-22 19:34:23 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory cdr
2015-7-22 19:34:25 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2015-7-22 19:34:25 org.apache.catalina.core.StandardContext start
严重: Context [/cdr] startup failed due to previous errors
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/cdr] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/cdr] 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.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [FileWatchdog] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-5] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-1] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 19:34:25 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/cdr] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak.
2015-7-22 19:34:25 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2015-7-22 19:34:25 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:9090
2015-7-22 19:34:25 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/10 config=null
2015-7-22 19:34:25 org.apache.catalina.startup.Catalina start
信息: Server startup in 2639 ms
这时候报错只能看到和JDBC有一些关系,报错不明显。
通过以下设置可以设置对于Tomcat的追踪,生成更为详细的错误报告:
在WEB-INF/classes目录下新建一个文件叫logging.properties,内容如下:
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = error-debug.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
这样,我们再启动tomcat时,就会在logs目录下生成一个更详细的日志error-debug.**.log
,并且详细报错也会在应用的日志中输出出来,通过该种设置,可以看到的详细错误如下:
......
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘cdr.gg_alarm_contact_r‘ doesn‘t exist
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘cdr.gg_alarm_contact_r‘ doesn‘t exist
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘cdr.gg_alarm_contact_r‘ doesn‘t exist
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
......
可以看到真正导致Tomcat无法启动的原因是由于数据库中缺乏表cdr.gg_alarm_contact_r,重新创建该表后应用启动正常。
总结:
Tomcat本身启动的报错可能都比较含糊,可能只提示了Error listenerStart。为了调试,我们要获得更详细的日志,这时候就可以通过这种方法进行设置,从而更有效的追踪具体的报错。
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:tomcat
原文地址:http://blog.csdn.net/badly9/article/details/47082003