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 HibernateTransactionManager
2014-06-13 14:30:21 [localhost-startStop-1] INFO  [ ContextLoader ] - Root WebApplicationContext: initialization completed in 7903 ms
Jun 13, 2014 2:30:21 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jun 13, 2014 2:30:21 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/adver] startup failed due to previous errors
Jun 13, 2014 2:30:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: 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 deployWAR
INFO: 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 log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jun 13, 2014 2:33:35 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jun 13, 2014 2:33:43 PM org.apache.catalina.core.ApplicationContext log
INFO: 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 log
INFO: Initializing Logback from [classpath:dev/logback.xml]
Jun 13, 2014 2:33:43 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class ch.qos.logback.ext.spring.web.LogbackConfigListener
java.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 log
INFO: Shutting down Logback
Jun 13, 2014 2:33:44 PM org.apache.catalina.core.ApplicationContext log
INFO: 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。

 

posted @ 2014-06-13 16:55  Lblogs  阅读(62309)  评论(1编辑  收藏  举报