我正在 Tomcat7、JDK1.7、Maven 和其他组件上开发 Spring 应用程序。最近,我对应用程序进行了重大更改,需要切换到 Spring 3。更改后,我在部署到开发服务器时看到以下异常。该应用程序在我的本地系统上运行完美。
javax.servlet.ServletException: Servlet.init() for servlet amadeusAce threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
root cause
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/amadeusAce-servlet.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getResourceLoader()Lorg/springframework/core/io/ResourceLoader;
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:375)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:311)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:258)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:229)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
root cause
java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getResourceLoader()Lorg/springframework/core/io/ResourceLoader;
org.springframework.context.annotation.ComponentScanBeanDefinitionParser.configureScanner(ComponentScanBeanDefinitionParser.java:100)
org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:83)
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1114)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1104)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:133)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:458)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:353)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:311)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:258)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:229)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
我认为上述 xml 也没有任何问题,amadeusAce-servlet.xml
因为自上次部署以来文件没有任何变化。
POM.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ace.amadeus</groupId>
<artifactId>AmadeusSpring</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>Simple CXF project using spring configuration</name>
<repositories>
<repository>
<id>JBoss repository</id>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>java.net2</id>
<name>Java.net</name>
<url>https://oss.sonatype.org/content/repositories/java.net2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-ibatis</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.5.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-validation</artifactId>
<version>0.8a</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>uk.com.robust-it</groupId>
<artifactId>cloning</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>sax</groupId>
<artifactId>sax</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
您可以从上述资源中看到什么?我非常希望收到您的来信。谢谢你。
编辑:
正如下面帖子中所建议的,我找到了解决依赖关系的类路径。结果如下:
file:/D:/ace-amadeus-ws/AmadeusSpring/target/classes/
file:/C:/Users/pc/.m2/repository/org/apache/httpcomponents/httpclient/4.2.2/httpclient-4.2.2.jar
file:/C:/Users/pc/.m2/repository/org/apache/httpcomponents/httpcore/4.2.2/httpcore-4.2.2.jar
file:/C:/Users/pc/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
file:/C:/Users/pc/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
file:/C:/Users/pc/.m2/repository/javax/ws/rs/jsr311-api/0.2/jsr311-api-0.2.jar
file:/C:/Users/pc/.m2/repository/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxws/2.1.3/cxf-rt-frontend-jaxws-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/geronimo/specs/geronimo-jaxws_2.1_spec/1.0/geronimo-jaxws_2.1_spec-1.0.jar
file:/C:/Users/pc/.m2/repository/org/apache/geronimo/specs/geronimo-activation_1.1_spec/1.0.2/geronimo-activation_1.1_spec-1.0.2.jar
file:/C:/Users/pc/.m2/repository/asm/asm/2.2.3/asm-2.2.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-api/2.1.3/cxf-api-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-common-utilities/2.1.3/cxf-common-utilities-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec-1.0.1.jar
file:/C:/Users/pc/.m2/repository/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar
file:/C:/Users/pc/.m2/repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar
file:/C:/Users/pc/.m2/repository/org/apache/ws/commons/schema/XmlSchema/1.4.2/XmlSchema-1.4.2.jar
file:/C:/Users/pc/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.1.1/geronimo-annotation_1.0_spec-1.1.1.jar
file:/C:/Users/pc/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.6/wstx-asl-3.2.6.jar
file:/C:/Users/pc/.m2/repository/org/apache/neethi/neethi/2.0.4/neethi-2.0.4.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-common-schemas/2.1.3/cxf-common-schemas-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-core/2.1.3/cxf-rt-core-2.1.3.jar
file:/C:/Users/pc/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.7/jaxb-impl-2.1.7.jar
file:/C:/Users/pc/.m2/repository/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.3/geronimo-javamail_1.4_spec-1.3.jar
file:/C:/Users/pc/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.2/FastInfoset-1.2.2.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-bindings-soap/2.1.3/cxf-rt-bindings-soap-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-tools-common/2.1.3/cxf-tools-common-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar
file:/C:/Users/pc/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.1.7/jaxb-xjc-2.1.7.jar
file:/C:/Users/pc/.m2/repository/org/apache/geronimo/specs/geronimo-ws-metadata_2.0_spec/1.1.2/geronimo-ws-metadata_2.0_spec-1.1.2.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-databinding-jaxb/2.1.3/cxf-rt-databinding-jaxb-2.1.3.jar
file:/C:/Users/pc/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-bindings-xml/2.1.3/cxf-rt-bindings-xml-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-frontend-simple/2.1.3/cxf-rt-frontend-simple-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-ws-addr/2.1.3/cxf-rt-ws-addr-2.1.3.jar
file:/C:/Users/pc/.m2/repository/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar
file:/C:/Users/pc/.m2/repository/com/sun/xml/messaging/saaj/saaj-impl/1.3.2/saaj-impl-1.3.2.jar
file:/C:/Users/pc/.m2/repository/org/apache/cxf/cxf-rt-transports-http/2.1.3/cxf-rt-transports-http-2.1.3.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-web/3.0.5.RELEASE/spring-web-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-context-support/3.0.5.RELEASE/spring-context-support-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-ibatis/2.0.8/spring-ibatis-2.0.8.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-dao/2.0.8/spring-dao-2.0.8.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-jdbc/2.0.8/spring-jdbc-2.0.8.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring-aspects/3.0.5.RELEASE/spring-aspects-3.0.5.RELEASE.jar
file:/C:/Users/pc/.m2/repository/org/springmodules/spring-modules-validation/0.8a/spring-modules-validation-0.8a.jar
file:/C:/Users/pc/.m2/repository/commons-lang/commons-lang/2.2/commons-lang-2.2.jar
file:/C:/Users/pc/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar
file:/C:/Users/pc/.m2/repository/commons-validator/commons-validator/1.3.0/commons-validator-1.3.0.jar
file:/C:/Users/pc/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
file:/C:/Users/pc/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
file:/C:/Users/pc/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
file:/C:/Users/pc/.m2/repository/commons-digester/commons-digester/1.7/commons-digester-1.7.jar
file:/C:/Users/pc/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar
file:/C:/Users/pc/.m2/repository/org/springframework/spring/2.0.3/spring-2.0.3.jar
file:/C:/Users/pc/.m2/repository/rhino/js/1.6R2/js-1.6R2.jar
file:/C:/Users/pc/.m2/repository/org/apache/tiles/tiles-jsp/2.0.7/tiles-jsp-2.0.7.jar
file:/C:/Users/pc/.m2/repository/org/apache/tiles/tiles-core/2.0.7/tiles-core-2.0.7.jar
file:/C:/Users/pc/.m2/repository/org/apache/tiles/tiles-api/2.0.7/tiles-api-2.0.7.jar
file:/C:/Users/pc/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
file:/C:/Users/pc/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar
file:/C:/Users/pc/.m2/repository/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar
file:/C:/Users/pc/.m2/repository/taglibs/standard/1.1.2/standard-1.1.2.jar
file:/C:/Users/pc/.m2/repository/commons-dbcp/commons-dbcp/20030825.184428/commons-dbcp-20030825.184428.jar
file:/C:/Users/pc/.m2/repository/commons-pool/commons-pool/20030825.183949/commons-pool-20030825.183949.jar
file:/C:/Users/pc/.m2/repository/org/apache/ibatis/ibatis-sqlmap/2.3.4.726/ibatis-sqlmap-2.3.4.726.jar
file:/C:/Users/pc/.m2/repository/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar
file:/C:/Users/pc/.m2/repository/uk/com/robust-it/cloning/1.8.2/cloning-1.8.2.jar
file:/C:/Users/pc/.m2/repository/org/objenesis/objenesis/1.2/objenesis-1.2.jar
file:/C:/Users/pc/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
file:/C:/Users/pc/.m2/repository/sax/sax/2.0.1/sax-2.0.1.jar