启动报错 Error listenerStart

今天同事遇到一个tomcat启动失败的问题,日志信息很少,不知如何分析。tomcat启动报错,也就是catalina.yyyy-mm-dd.log:
严重: Error listenerStart
2015-6-4 17:25:28 org.apache.catalina.core.StandardContext start
严重: Context [/app] startup failed due to previous errors
...

单纯看这一段错误给出的报错原因一般都不对,很容易被误导。

目前本人遇到这个问题一般都是因为配置文件不对导致的,马上查看tomcat目录下的localhost.yyyy-mm-dd.log:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring/spring-config.xml]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'package.flag' in string value "spring-config-${package.flag}.xml"
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:530)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:444)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:388)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)


这里基本上都会输出具体的错误原因,一看就明白。
所以这种"Error listenerStart"启动报错,错误信息又少的时候可以尝试这样解决。问题很简单,主要是找到正确的错误日志。

你可能感兴趣的:(listener)