Tomcat启动失败问题解决

1. 系统框架加载正常,但是Tomcat启动失败,报错如下:

 

2013-7-26 17:18:33 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
2013-7-26 17:18:34 org.apache.catalina.util.SessionIdGenerator createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [452] milliseconds.
2013-7-26 17:18:34 org.apache.catalina.core.StandardContext startInternal
严重: Context [] startup failed due to previous errors
2013-7-26 17:18:34 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
2013-7-26 17:18:34 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
2013-7-26 17:18:34 org.apache.catalina.startup.Catalina start
信息: Server startup in 9576 ms
diamond client log path : /home/admin/xxx/target/../logs/xx-client.log
2013-7-26 17:18:57 org.apache.catalina.loader.WebappClassLoader loadClass
信息: Illegal access: this web application instance has been stopped already.  Could not load javax.xml.parsers.ParserConfigurationException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1587)
        at com.taobao.tomcat.classloader.TomcatWebAppClassLoader.loadClass(TomcatWebAppClassLoader.java:37)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
        at com.taobao.hsf.container.HSFClassLoaderDelegateHook.postFindClass(HSFClassLoaderDelegateHook.java:96)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.searchHooks(BundleLoader.java:495)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:461)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)

 

2. 分析

      查看上述日志,可能会很明显的看到下面很多的exception。都是this web application instance has been stopped already以及Could not load XX Class。但是不要被这些异常迷惑,他们只是结果而不是原因。

1). 细致一点可以查看到,哪些日志是Tomcat是启动完成之后报错的。Server startup in 9576 ms

2). Tomcat日志中有:严重: Error listenerStart。

3). 除了Error listenerStart没有详细日志,但是可以知道是web.xml中listener初始化的时候出错了。

 

 

 

3. 处理

1). 在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 = ${应用目录}/logs  
org.apache.juli.FileHandler.prefix = error-debug.  
  
java.util.logging.ConsoleHandler.level = FINE  
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter  

2). 重新启动应用,指定目录下会有一个error-debug.2013-07-07.log的错误日志,或者错误日志生成在jboss_stdout.log中。(日志在Error listenerStart 到 Server startup in 9576 ms之间)

 

4. 结果

 

2013-7-29 9:58:11 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2013-7-29 9:58:16 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class com.alibaba.citrus.webx.context.WebxContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:web/common/uris.xml]
Offending resource: ServletContext resource [/WEB-INF/webx.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [web/common/uris.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionAttributes(Lorg/w3c/dom/Element;Ljava/lang/String;Lorg/springframework/beans/factory/config/BeanDefinition;Lorg/springframework/beans/factory/support/AbstractBeanDefinition;)Lorg/springframework/beans/factory/support/AbstractBeanDefinition;
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [web/common/uris.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionAttributes(Lorg/w3c/dom/Element;Ljava/lang/String;Lorg/springframework/beans/factory/config/BeanDefinition;Lorg/springframework/beans/factory/support/AbstractBeanDefinition;)Lorg/springframework/beans/factory/support/AbstractBeanDefinition;
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionAttributes(Lorg/w3c/dom/Element;Ljava/lang/String;Lorg/springframework/beans/factory/config/BeanDefinition;Lorg/springframework/beans/factory/support/AbstractBeanDefinition;)Lorg/springframework/beans/factory/support/AbstractBeanDefinition;
        at com.alibaba.citrus.springext.util.SpringExtUtil.parseBeanDefinitionAttributes(SpringExtUtil.java:223)
        at com.alibaba.citrus.service.uribroker.impl.URIBrokerServiceDefinitionParser.doParse(URIBrokerServiceDefinitionParser.java:48)
        at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:81)
        at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56)
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1123)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1113)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:133)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:468)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:363)

 

5. 看到上述日志,问题就很容易解决了,明显是由于spring的类冲突导致,分析之后发现,是由于spring-2.0.7与spring-2.5.6的类冲突导致。

 

6. 如果上述不行,可以尝试:

http://www.havenliu.com/web/298.html

http://grails.1312388.n4.nabble.com/Deployment-problems-td4628710.html

http://xpenxpen.iteye.com/blog/1545648

你可能感兴趣的:(Server)