启动tomcat服务器获取SEVERE:上下文初始化失败

时间:2014-09-06 16:32:18

标签: spring tomcat

我遇到的错误是当我使用ant成功部署后启动tomcat服务器时出现此错误。

  

org.springframework.beans_3.0.5.RELEASE.jar

     

org.springframework.context-3.2.0.release.jar

     

org.springframework.jdbc.jar

     

org.springframework.orm.jar

     

org.springframework.transaction_3.0.5.RELEASE.jar

     

弹簧芯3.1.1.RELEASE.jar

     

弹簧-DAO-2.0.7.jar

     

弹簧 - 测试 - 4.0.0.RELEASE.jar

     

弹簧网络3.2.1.RELEASE-sources.jar

     

弹簧webmvc.jar

错误

  Sep 06, 2014 8:39:18 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: Loaded APR based Apache Tomcat Native library 1.1.30 using APR version 1.4.8.
    Sep 06, 2014 8:39:18 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
    Sep 06, 2014 8:39:20 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
    INFO: OpenSSL successfully initialized (OpenSSL 1.0.1g 7 Apr 2014)
    Sep 06, 2014 8:39:21 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-apr-8090"]
    Sep 06, 2014 8:39:21 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
    Sep 06, 2014 8:39:21 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 3466 ms
    Sep 06, 2014 8:39:21 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Sep 06, 2014 8:39:21 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/8.0.9
    Sep 06, 2014 8:39:21 PM org.apache.catalina.startup.HostConfig deployWAR
    INFO: Deploying web application archive C:\Users\Chander\apache-tomcat8\webapps\springapp.war
    Sep 06, 2014 8:39:25 PM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    Sep 06, 2014 8:39:25 PM org.springframework.web.context.ContextLoader initWebApplicationContext
    INFO: Root WebApplicationContext: initialization started
    Sep 06, 2014 8:39:25 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@4359712c: display name [Root WebApplicationContext]; startup date [Sat Sep 06 20:39:25 IST 2014]; root of context hierarchy
    Sep 06, 2014 8:39:26 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/springapp-servlet.xml]
    Sep 06, 2014 8:39:28 PM org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/springapp-servlet.xml]; nested exception is java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4760)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
        at org.springframework.context.config.ContextNamespaceHandler$1.parse(ContextNamespaceHandler.java:65)
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
        ... 26 more

    Sep 06, 2014 8:39:28 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: 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 ServletContext resource [/WEB-INF/springapp-servlet.xml]; nested exception is java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4760)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
        at org.springframework.context.config.ContextNamespaceHandler$1.parse(ContextNamespaceHandler.java:65)
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
        ... 26 more

    Sep 06, 2014 8:39:28 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Sep 06, 2014 8:39:29 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [431] milliseconds.
    Sep 06, 2014 8:39:29 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/springapp] startup failed due to previous errors
    Sep 06, 2014 8:39:29 PM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Sep 06, 2014 8:39:29 PM org.apache.catalina.startup.HostConfig deployWAR
    INFO: Deployment of web application archive C:\Users\Chander\apache-tomcat8\webapps\springapp.war has finished in 7,903 ms
    Sep 06, 2014 8:39:29 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Users\Chander\apache-tomcat8\webapps\docs
    Sep 06, 2014 8:39:29 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deployment of web application directory C:\Users\Chander\apache-tomcat8\webapps\docs has finished in 127 ms
    Sep 06, 2014 8:39:29 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Users\Chander\apache-tomcat8\webapps\examples
    Sep 06, 2014 8:39:31 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    Sep 06, 2014 8:39:31 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deployment of web application directory C:\Users\Chander\apache-tomcat8\webapps\examples has finished in 1,841 ms
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Users\Chander\apache-tomcat8\webapps\host-manager
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deployment of web application directory C:\Users\Chander\apache-tomcat8\webapps\host-manager has finished in 121 ms
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Users\Chander\apache-tomcat8\webapps\manager
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deployment of web application directory C:\Users\Chander\apache-tomcat8\webapps\manager has finished in 121 ms
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Users\Chander\apache-tomcat8\webapps\ROOT
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deployment of web application directory C:\Users\Chander\apache-tomcat8\webapps\ROOT has finished in 89 ms
    Sep 06, 2014 8:39:31 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-apr-8090"]
    Sep 06, 2014 8:39:31 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-apr-8009"]
    Sep 06, 2014 8:39:31 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 10412 ms

2 个答案:

答案 0 :(得分:2)

你有MajorJavaVersion>在AnnotationConfigBeanDefinitionParser类中检查的最高版本。

例如在我的例子中,在删除Java 1.8之后,错误就消失了。

因此,您可以使用较新的Spring库或删除/更改您的主要Java,以便Spring库中的旧代码可以成功检查。

答案 1 :(得分:0)

你的弹簧库版本有问题,我看到你混合所有弹簧版本:3.0.5,3.1.1,3.2.1,2.0.7和4.0.0。尝试使用相同版本的spring库,例如3.2.1用于所有spring框架依赖项,并查看是否有修复。