首页 > 代码库 > org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart

org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart

  今天将项目部署到Centos 6.3 x64上面的tomcat 7.0.54,访问链接出现了404错误。后来查看了/usr/local/apache-tomcat-7.0.54/logs/catalina.out 文件,出现了Error listenerStart 。

org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart 

 

2014-06-13 14:30:20 [localhost-startStop-1] INFO  [ HibernateTransactionManager ] - Using DataSource [org.apache.commons.dbcp.BasicDataSource@247973e4] of Hibernate SessionFactory for HibernateTransactionManager2014-06-13 14:30:21 [localhost-startStop-1] INFO  [ ContextLoader ] - Root WebApplicationContext: initialization completed in 7903 msJun 13, 2014 2:30:21 PM org.apache.catalina.core.StandardContext startInternalSEVERE: Error listenerStartJun 13, 2014 2:30:21 PM org.apache.catalina.core.StandardContext startInternalSEVERE: Context [/adver] startup failed due to previous errorsJun 13, 2014 2:30:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbcSEVERE: The web application [/adver] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.Jun 13, 2014 2:30:21 PM org.apache.catalina.startup.HostConfig deployWARINFO: Deployment of web application archive /usr/local/apache-tomcat-7.0.54/webapps/adver.war has finished in 20,703 ms

  再去查看/usr/local/apache-tomcat-7.0.54/logs/localhost.2014-06-13.log 文件,

Jun 13, 2014 2:33:35 PM org.apache.catalina.core.ApplicationContext logINFO: No Spring WebApplicationInitializer types detected on classpathJun 13, 2014 2:33:35 PM org.apache.catalina.core.ApplicationContext logINFO: Initializing Spring root WebApplicationContextJun 13, 2014 2:33:43 PM org.apache.catalina.core.ApplicationContext logINFO: Set web app root system property: ‘webapp.root‘ = [/usr/local/apache-tomcat-7.0.54/webapps/adver/]Jun 13, 2014 2:33:43 PM org.apache.catalina.core.ApplicationContext logINFO: Initializing Logback from [classpath:dev/logback.xml]Jun 13, 2014 2:33:43 PM org.apache.catalina.core.StandardContext listenerStartSEVERE: Exception sending context initialized event to listener instance of class ch.qos.logback.ext.spring.web.LogbackConfigListenerjava.lang.IllegalArgumentException: Invalid ‘logbackConfigLocation‘ parameter: class path resource [dev/logback.xml] cannot be resolved to URL because it does not exist        at ch.qos.logback.ext.spring.web.WebLogbackConfigurer.initLogging(WebLogbackConfigurer.java:144)        at ch.qos.logback.ext.spring.web.LogbackConfigListener.contextInitialized(LogbackConfigListener.java:54)        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)        at java.util.concurrent.FutureTask.run(FutureTask.java:138)        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)        at java.lang.Thread.run(Thread.java:662)Jun 13, 2014 2:33:44 PM org.apache.catalina.core.ApplicationContext logINFO: Shutting down LogbackJun 13, 2014 2:33:44 PM org.apache.catalina.core.ApplicationContext logINFO: Closing Spring root WebApplicationContext

  由此日志文件可以知道,在web.xml 初始化logback监听器的的时候找不到classpath:dev/logback.xml。

  后来去/usr/local/apache-tomcat-7.0.54/webapps/adver/WEB-INF/classes/ 看了,也真的是下面没有dev/logback.xml文件夹。明明在开发的时候,在tomcat里面也是有的。 但是发布的时候,就没有。

找到原因:是因为用maven打包的,maven并没有将dev/logback.xml放到WEB-INF/classes里,而是直接将logbak.xml放在WEB-INF/classes。