Spring 应用程序无法在 Tomcat 上部署:applicationContext 有啥问题?

Posted

技术标签:

【中文标题】Spring 应用程序无法在 Tomcat 上部署:applicationContext 有啥问题?【英文标题】:Spring application fails to deploy on Tomcat: whats wrong with applicationContext?Spring 应用程序无法在 Tomcat 上部署:applicationContext 有什么问题? 【发布时间】:2014-06-20 11:21:14 【问题描述】:

我的父母pom.xml 看起来像

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.0.3.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.0.3.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>4.0.3.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.7</version>
</dependency>
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.1.2</version>
</dependency>

我的服务pom.xml

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-spring3</artifactId>
        <version>2.8</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.test.framework</groupId>
        <artifactId>jersey-test-framework</artifactId>
        <version>1.0.3.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <warName>pryme-inventory</warName>
            </configuration>
        </plugin>
    </plugins>
</build>

和集成pom.xml

    <dependency>
        <groupId>com.org.my_services.inventory</groupId>
        <artifactId>services</artifactId>
        <type>war</type>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.7</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.12</version>
        </plugin>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.8</version>
            <executions>
                <execution>
                    <id>start-container</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-container</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <container>
                    <containerId>tomcat7x</containerId>
                    <home>/Users/harith/Downloads/apache-tomcat-7.0.53</home>
                    <!--<zipUrlInstaller>
                        <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip</url>
                        <downloadDir>$project.build.directory/downloads</downloadDir>
                        <extractDir>$project.build.directory/extracts</extractDir>
                    </zipUrlInstaller>-->
                </container>
                <deployables>
                    <deployable>
                        <groupId>com.yahoo.pryme_services.inventory</groupId>
                        <artifactId>services</artifactId>
                        <type>war</type>
                    </deployable>
                </deployables>
            </configuration>
        </plugin>
    </plugins>
</build>

我的applicationContext.xml 看起来像

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <context:component-scan base-package="com.org.my_services.inventory.*" />
</beans>

web.xml

<web-app>
    <servlet>
        <servlet-name>InventoryApplication</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>InventoryApplication</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
</web-app>

当我尝试运行mvn cargo:run 时,我看到applicationConext 中的错误为

[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
[INFO] [talledLocalContainer] INFO: Refreshing Root WebApplicationContext: startup date [Sat May 03 16:00:09 PDT 2014]; root of context hierarchy
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
[INFO] [talledLocalContainer] INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.springframework.web.context.ContextLoader initWebApplicationContext
[INFO] [talledLocalContainer] SEVERE: Context initialization failed
[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
[INFO] [talledLocalContainer]   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
[INFO] [talledLocalContainer]   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
[INFO] [talledLocalContainer]   at org.springframework.context.annotation.AnnotationConfigUtils.registerAnnotationConfigProcessors(AnnotationConfigUtils.java:190)
[INFO] [talledLocalContainer]   at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.registerComponents(ComponentScanBeanDefinitionParser.java:150)
[INFO] [talledLocalContainer]   at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:86)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
[INFO] [talledLocalContainer]   ... 26 more
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.apache.catalina.core.StandardContext listenerStart
[INFO] [talledLocalContainer] SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
[INFO] [talledLocalContainer]   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
[INFO] [talledLocalContainer]   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
[INFO] [talledLocalContainer]   at org.springframework.context.annotation.AnnotationConfigUtils.registerAnnotationConfigProcessors(AnnotationConfigUtils.java:190)
[INFO] [talledLocalContainer]   at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.registerComponents(ComponentScanBeanDefinitionParser.java:150)
[INFO] [talledLocalContainer]   at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:86)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
[INFO] [talledLocalContainer]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
[INFO] [talledLocalContainer]   ... 26 more
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.apache.catalina.core.StandardContext startInternal
[INFO] [talledLocalContainer] SEVERE: Error listenerStart
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.apache.catalina.core.StandardContext startInternal
[INFO] [talledLocalContainer] SEVERE: Context [/services] startup failed due to previous errors
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.apache.catalina.core.ApplicationContext log
[INFO] [talledLocalContainer] INFO: Closing Spring root WebApplicationContext
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
[INFO] [talledLocalContainer] INFO: Closing Root WebApplicationContext: startup date [Sat May 03 16:00:09 PDT 2014]; root of context hierarchy
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
[WARNING] [talledLocalContainer] WARNING: Exception thrown from ApplicationListener handling ContextClosedEvent
[INFO] [talledLocalContainer] java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sat May 03 16:00:09 PDT 2014]; root of context hierarchy
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:880)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5014)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5659)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
[WARNING] [talledLocalContainer] WARNING: Exception thrown from LifecycleProcessor on context close
[INFO] [talledLocalContainer] java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sat May 03 16:00:09 PDT 2014]; root of context hierarchy
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:359)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:888)
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5014)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5659)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] May 03, 2014 4:00:09 PM org.apache.catalina.core.StandardContext listenerStop

我不知道是什么导致了这个问题,请有人帮忙

【问题讨论】:

看起来是版本冲突,三重检查您的 Web 应用程序类路径不包含 rouge 不兼容的 Spring jar。 不确定是否是问题所在,但您的基本包不需要 .* 结尾。 尝试运行 maven 依赖项:树,以便我们查看您的 jars;此外,DavidA 说的是正确的......你不需要 .* 在 base-package 的末尾 【参考方案1】:

jersey-spring3 依赖于 Spring 3.2.3。找不到的方法 (DefaultListableBeanFactory.getDependencyComparator()) 一直是 introduced in Spring 4,我会说这就是您得到该异常的原因。

【讨论】:

以上是关于Spring 应用程序无法在 Tomcat 上部署:applicationContext 有啥问题?的主要内容,如果未能解决你的问题,请参考以下文章

无法在外部 tomcat 上部署 Spring Boot 应用程序

Spring Boot在部署到Tomcat期间无法加载外部jar

无法使用通过 Tomcat 部署的 Spring 应用程序来本地 MySQL 数据库

部署在tomcat上的Spring Boot无法启动

多个Spring Boot项目部署在一个Tomcat容器无法启动

部署到 Tomcat 10 后无法访问 Spring Boot 应用程序 [重复]