java.lang.NoSuchMethodError:org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava / lang / String;)V

下面是我的spring批处理项目的pom.xml,如果我在jboss 5中部署,我得到以下exception,但如果我在本地windows机器上部署,同样的战争工作正常。 我怀疑jar中的org.springframework:spring-context:jar:2.5.6存在冲突org.springframework:spring-context:jar:2.5.6

即使我尝试在春季批量依赖中排除弹簧核心jar,但我无法解决这个问题,任何人都可以提前帮助。有没有办法排除spring-context:jar:2.5.6

 Error Trace java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:369) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145) at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122) at org.jboss.web.deployers.WebModule.start(WebModule.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) 

mvn依赖:树

  +- org.springframework:spring-context:jar:2.5.6:compile | \- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile +- org.springframework:spring-beans:jar:2.5.6:compile +- org.springframework:spring-core:jar:2.5.6:compile +- org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile +- org.springframework:spring-tx:jar:2.5.6:compile +- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile +- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile +- org.springframework:spring-aspects:jar:3.1.1.RELEASE:compile +- org.springframework:spring-jms:jar:3.1.1.RELEASE:compile +- org.springframework:spring-orm:jar:3.1.0.RC2:compile +- org.springframework:spring-oxm:jar:3.1.1.RELEASE:compile | \- commons-lang:commons-lang:jar:2.5:compile +- org.springframework:spring-web:jar:3.1.0.RC2:compile +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile +- org.springframework:org.springframework.web.servlet:jar:3.1.1.RELEASE:compile | +- org.springframework:org.springframework.beans:jar:3.1.1.RELEASE:compile | | \- org.springframework:org.springframework.asm:jar:3.1.1.RELEASE:compile | +- org.springframework:org.springframework.context:jar:3.1.1.RELEASE:compile | | \- org.springframework:org.springframework.aop:jar:3.1.1.RELEASE:compile | +- org.springframework:org.springframework.context.support:jar:3.1.1.RELEASE:compile | +- org.springframework:org.springframework.core:jar:3.1.1.RELEASE:compile | +- org.springframework:org.springframework.expression:jar:3.1.1.RELEASE:compile | \- org.springframework:org.springframework.web:jar:3.1.1.RELEASE:compile | \- org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile +- org.springframework:spring-struts:jar:3.1.1.RELEASE:compile | +- struts:struts:jar:1.2.9:compile | | +- commons-digester:commons-digester:jar:1.6:compile | | | \- xml-apis:xml-apis:jar:1.0.b2:compile | | +- commons-validator:commons-validator:jar:1.1.4:compile | | +- oro:oro:jar:2.0.7:compile | | \- xalan:xalan:jar:2.5.1:compile | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile +- org.springframework:spring-webmvc-portlet:jar:3.1.1.RELEASE:compile +- org.springframework:spring-instrument:jar:3.1.1.RELEASE:compile +- org.springframework:spring-instrument-tomcat:jar:3.1.1.RELEASE:compile +- org.springframework:spring-test:jar:3.1.1.RELEASE:compile +- commons-logging:commons-logging:jar:1.1.1:compile +- org.slf4j:jcl-over-slf4j:jar:1.5.10:compile +- log4j:log4j:jar:1.2.15:compile | +- javax.mail:mail:jar:1.4:compile | +- com.sun.jdmk:jmxtools:jar:1.2.1:compile | \- com.sun.jmx:jmxri:jar:1.2.1:compile +- org.slf4j:slf4j-api:jar:1.5.10:compile +- org.slf4j:slf4j-log4j12:jar:1.5.10:compile +- net.sf.ehcache:ehcache-core:jar:2.3.0:compile +- org.freemarker:freemarker:jar:2.3.15:compile +- aopalliance:aopalliance:jar:1.0:compile +- aspectj:aspectjweaver:jar:1.5.2:compile +- cglib:cglib-nodep:jar:2.1_3:compile +- org.codehaus.jettison:jettison:jar:1.3:compile | \- stax:stax-api:jar:1.0.1:compile +- com.thoughtworks.xstream:xstream:jar:1.3:compile | \- xpp3:xpp3_min:jar:1.1.4c:compile +- junit:junit:jar:4.0:compile +- commons-dbcp:commons-dbcp:jar:1.4:compile +- commons-codec:commons-codec:jar:1.6:compile +- commons-pool:commons-pool:jar:1.6:compile +- commons-fileupload:commons-fileupload:jar:1.2.1:compile +- commons-io:commons-io:jar:1.4:compile +- antlr:antlr:jar:2.7.7:compile +- dom4j:dom4j:jar:1.6.1:compile +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile +- org.hibernate:hibernate-core:jar:4.1.4.Final:compile +- org.hibernate:hibernate-entitymanager:jar:4.1.4.Final:compile +- org.hibernate:hibernate-envers:jar:4.1.4.Final:compile +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile +- org.javassist:javassist:jar:3.15.0-GA:compile +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile +- com.oracle:ojdbc5:jar:11.2.0.2.0:compile +- org.skywaysoftware:skyway-spring-utils:jar:7.1.3:compile | +- javax.persistence:persistence-api:jar:1.0.2:compile | +- javax.servlet:servlet-api:jar:2.4:compile | +- org.apache.cxf:cxf-bundle-minimal:jar:2.1.9:compile | | +- org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1.1:compile | | +- javax.xml.bind:jaxb-api:jar:2.1:compile | | +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile | | +- wsdl4j:wsdl4j:jar:1.6.2:compile | | +- xml-resolver:xml-resolver:jar:1.2:compile | | +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.5:compile | | +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.2:compile | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.9:compile | | +- org.apache.neethi:neethi:jar:2.0.4:compile | | +- com.sun.xml.bind:jaxb-impl:jar:2.1.9:compile | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.3:compile | | +- org.mortbay.jetty:jetty:jar:6.1.21:compile | | +- org.mortbay.jetty:jetty-util:jar:6.1.21:compile | | +- org.apache.geronimo.specs:geronimo-servlet_2.5_spec:jar:1.2:compile | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile | | +- javax.xml.soap:saaj-api:jar:1.3:compile | | +- jdom:jdom:jar:1.0:compile | | +- jaxen:jaxen:jar:1.1:compile | | +- com.sun.xml.bind:jaxb-xjc:jar:2.1.9:compile | | +- org.apache.geronimo.specs:geronimo-jaxws_2.1_spec:jar:1.0:compile | | +- org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec:jar:1.1.2:compile | | +- asm:asm:jar:2.2.3:compile | | +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.2:compile | | +- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile | | +- org.apache.santuario:xmlsec:jar:1.4.3:compile | | +- xalan:serializer:jar:2.7.1:compile | | \- org.bouncycastle:bcprov-jdk15:jar:1.43:runtime | +- org.apache.ws.security:wss4j:jar:1.5.8:compile | +- org.springframework.security:spring-security-core:jar:2.0.4:compile | | \- org.springframework:spring-support:jar:2.0.8:runtime | \- org.springframework.webflow:spring-binding:jar:2.4.0.M1:compile | \- opensymphony:ognl:jar:2.6.11:compile +- com.ibm.mq.commonservices:com.ibm.mq.commonservices:jar:7.0.1.3:compile +- com.ibm.mq:dhbcore:jar:7.0.1.9:compile +- javax.resource:connector:jar:1.0:compile +- com.ibm.mq.headers:com.ibm.mq.headers:jar:7.0.1.3:compile +- com.ibm.mq:com.ibm.mq:jar:7.0.1.9:compile +- com.ibm.mq:com.ibm.mq.jmqi:jar:7.0.1.9:compile +- com.ibm.mq:com.ibm.mqjms:jar:7.0.1.9:compile +- com.sun.messaging.mq:fscontext:jar:4.4.2:compile +- javax.jms:jms:jar:1.1:compile +- simple-jndi:simple-jndi:jar:0.11.4.1:compile +- javax.transaction:jta:pom:1.0.1B:compile +- com.sun.jndi:providerutil:pom:1.2:compile +- org.springframework.batch:spring-batch-core:jar:2.1.8.RELEASE:compile +- org.springframework.batch:spring-batch-infrastructure:jar:2.1.8.RELEASE:compile +- org.springframework.batch:spring-batch-integration:jar:1.2.1.RELEASE:compile +- org.springframework.batch:spring-batch-admin-resources:jar:1.2.1.RELEASE:compile | \- commons-collections:commons-collections:jar:3.2:compile +- org.springframework.batch:spring-batch-admin-manager:jar:1.2.1.RELEASE:compile | \- org.aspectj:aspectjrt:jar:1.6.6:compile +- org.springframework.integration:spring-integration-core:jar:2.0.3.RELEASE:compile +- org.springframework.integration:spring-integration-file:jar:2.0.3.RELEASE:compile +- org.springframework.integration:spring-integration-jmx:jar:2.0.3.RELEASE:compile | \- org.aspectj:aspectjweaver:jar:1.6.6:compile +- org.springframework.integration:spring-integration-http:jar:2.0.3.RELEASE:compile +- org.jboss.resteasy:resteasy-jaxrs:jar:2.2.1.GA:compile | +- org.jboss.resteasy:jaxrs-api:jar:2.2.1.GA:compile | +- org.scannotation:scannotation:jar:1.0.3:compile | | \- javassist:javassist:jar:3.12.1.GA:compile | +- javax.annotation:jsr250-api:jar:1.0:compile | +- javax.activation:activation:jar:1.1:compile | +- commons-httpclient:commons-httpclient:jar:3.1:compile | +- org.apache.httpcomponents:httpclient:jar:4.0.3:compile | | \- org.apache.httpcomponents:httpcore:jar:4.0.1:compile | \- net.jcip:jcip-annotations:jar:1.0:compile \- org.jboss.resteasy:resteasy-jackson-provider:jar:2.2.1.GA:compile +- org.codehaus.jackson:jackson-core-asl:jar:1.6.3:compile +- org.codehaus.jackson:jackson-mapper-asl:jar:1.6.3:compile +- org.codehaus.jackson:jackson-jaxrs:jar:1.6.3:compile \- org.codehaus.jackson:jackson-xc:jar:1.6.3:compile  4.0.0 com.mycomp.pil MyProject 1.0.0-SNAPSHOT jar PIL: MyProject  3.1.1.RELEASE 2.0.3.RELEASE 2.1.8.RELEASE 1.2.1.RELEASE 4.1.4.Final 2.2.1.GA     org.springframework spring-context ${spring.framework.version}   org.springframework spring-context-support ${spring.framework.version}   org.springframework spring-beans ${spring.framework.version}   org.springframework spring-core ${spring.framework.version}   commons-logging commons-logging     org.springframework spring-jdbc ${spring.framework.version}   org.springframework spring-tx ${spring.framework.version}   org.springframework spring-aop ${spring.framework.version}   org.springframework spring-asm ${spring.framework.version}   org.springframework spring-aspects ${spring.framework.version}   org.springframework spring-jdbc ${spring.framework.version}   org.springframework spring-jms ${spring.framework.version}   org.springframework spring-orm ${spring.framework.version}   org.springframework spring-oxm ${spring.framework.version}   org.springframework spring-web ${spring.framework.version}   org.springframework spring-webmvc ${spring.framework.version}   org.springframework spring-tx ${spring.framework.version}   org.springframework org.springframework.web.servlet ${spring.framework.version}   org.springframework spring-struts ${spring.framework.version}   org.springframework spring-webmvc-portlet ${spring.framework.version}   org.springframework spring-instrument ${spring.framework.version}   org.springframework spring-instrument-tomcat ${spring.framework.version}   org.springframework.webflow spring-js 2.3.0.RELEASE   org.springframework.webflow spring-js-resources 2.3.0.RELEASE   org.springframework spring-test ${spring.framework.version}   org.springframework spring-instrument-tomcat ${spring.framework.version}    commons-logging commons-logging 1.1.1   org.slf4j jcl-over-slf4j 1.5.10   log4j log4j 1.2.15   org.slf4j slf4j-api 1.5.10   org.slf4j slf4j-log4j12 1.5.10 compile    net.sf.ehcache ehcache-core 2.3.0   org.freemarker freemarker 2.3.15   aopalliance aopalliance 1.0   aspectj aspectjweaver 1.5.2   cglib cglib-nodep 2.1_3   org.codehaus.jettison jettison 1.3   com.thoughtworks.xstream xstream 1.3   junit junit 4.0    commons-dbcp commons-dbcp 1.4   commons-codec commons-codec 1.6   commons-pool commons-pool 1.6   commons-fileupload commons-fileupload 1.2.1   commons-io commons-io 1.4    antlr antlr 2.7.7   dom4j dom4j 1.6.1   xml-apis xml-apis     org.hibernate.common hibernate-commons-annotations 4.0.1.Final   org.hibernate hibernate-core ${hibernate.core.version}   org.hibernate hibernate-entitymanager ${hibernate.core.version}   org.hibernate hibernate-envers ${hibernate.core.version}   org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final   org.javassist javassist 3.15.0-GA   org.jboss.logging jboss-logging 3.1.0.GA   org.jboss.spec.javax.transaction jboss-transaction-api_1.1_spec 1.0.0.Final    com.oracle ojdbc5 11.2.0.2.0   org.skywaysoftware skyway-spring-utils 7.1.3   org.slf4j slf4j-jdk14      com.ibm.mq.commonservices com.ibm.mq.commonservices 7.0.1.3   com.ibm.mq dhbcore 7.0.1.9  <!--  com.ibm.mq.connector connector 7.0.1.3   com.ibm.mq dhbcore 7.0.1.3  -->  javax.resource connector 1.0   com.ibm.mq.headers com.ibm.mq.headers 7.0.1.3   com.ibm.mq com.ibm.mq 7.0.1.9   com.ibm.mq com.ibm.mq.jmqi 7.0.1.9   com.ibm.mq com.ibm.mqjms 7.0.1.9   com.sun.messaging.mq fscontext 4.4.2   javax.jms jms 1.1   simple-jndi simple-jndi 0.11.4.1   jta jta 1.0.1b pom   com.sun.jndi providerutil 1.2 pom    org.springframework.batch spring-batch-core ${spring.batch.core}   commons-logging commons-logging     org.springframework.batch  spring-batch-infrastructure  ${spring.batch.core}   org.springframework.batch spring-batch-test ${spring.batch.core} test   org.springframework.batch spring-batch-integration ${spring.batch.admin}   org.springframework.batch spring-batch-admin-resources ${spring.batch.admin}   org.springframework.batch spring-batch-admin-manager ${spring.batch.admin}    org.springframework.integration spring-integration-core ${spring.integration.version}   org.springframework.integration spring-integration-file ${spring.integration.version}   org.springframework.integration spring-integration-jmx ${spring.integration.version}   org.springframework.integration spring-integration-http ${spring.integration.version}   org.jboss.resteasy resteasy-jaxrs ${jboss.resteasy.version}   org.jboss.resteasy resteasy-jackson-provider ${jboss.resteasy.version}      org.apache.maven.plugins maven-compiler-plugin 2.5.1  1.6 1.6      src/main/resources <!--  **/*.xml  -->     

您将Spring 3.1.1与Spring 2.5.6混合使用。 为那些仍在2.5.6上的Spring依赖项添加显式依赖项或依赖项管理条​​目,以将它们升级到3.1.1或降级项目。

作为战争的一部分,你打包过哪个版本的弹簧jar? 它有2.5.6吗? 你的战争是指它@从其他任何地方运行时间吗?

我可以看到以下方法来确定根本原因,1。以远程调试模式启动服务器。 2.如果没有,可以尝试jboss scoped类加载,

在WEB-INF下创建jboss-web.xml,

    com.example:archive=<> java2ParentDelegation=false    

将其替换为<>您的Web存档文件名。

看,如果这有帮助……