更新Spring版本后,上下文初始化失败

时间:2014-12-10 16:02:23

标签: java spring cxf nosuchmethoderror spring-4

我最近将我的Spring版本从3.2.4.RELEASE更新为4.0.7.RELEASE 从那时起,我在加载上下文时遇到了这个错误。

如果我在更新spring版本后必须对context xml进行任何更改,请告诉我。

这是 avengers-flow-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:int-jmx="http://www.springframework.org/schema/integration/jmx"
    xmlns:oxm="http://www.springframework.org/schema/oxm"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/integration
        http://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
        http://www.springframework.org/schema/integration/jmx http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd">

    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-properties-context.xml" />
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-common-context.xml" />
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-jms-context.xml" /> 
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-jmx-context.xml" />
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-saf-config.xml" /> 
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-saf-jms-config.xml" /> 
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-exception-context.xml" />
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-common-context.xml" /> 
    <beans:import resource="classpath*:/META-INF/spring/integration/avengers-hulc-flow-context.xml" />
    <beans:import resource="classpath*:/META-INF/spring/integration/cxf-servlet-context.xml" />

这是 avengers-hulc-flow-context.xml

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd 
                        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

    <!-- xml files in dependency jar -->
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <!-- End of dependent jar xml files -->

    <!-- hulc service rest container -->
    <jaxrs:client id="AlertRestService" 
            address="${application.ping.consumer.url}"
            serviceClass="com.marvel.avengers..hulc.client.hulcWebService">
            <jaxrs:headers>             
                <entry key="Accept" value="application/json"/>         
                <entry key="Type" value="application/json"/>         
            </jaxrs:headers>
            <jaxrs:providers>        
                <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>        
            </jaxrs:providers>
            <jaxrs:inInterceptors>
                <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
            </jaxrs:inInterceptors>         
            <jaxrs:outInterceptors>
                <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
            </jaxrs:outInterceptors>            
    </jaxrs:client>

    <!-- hulc service rest container -->
    <jaxrs:client id="hulcLifecycleRestService" 
            address="${{application.ping.hulc.lifecycle.consumer.url}"
            serviceClass="com.marvel.avengers..hulc.client.lc.LifecycleWebService">
            <jaxrs:headers>             
                <entry key="Accept" value="application/json"/>         
                <entry key="Type" value="application/json"/>         
            </jaxrs:headers>
            <jaxrs:providers>        
                <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>        
            </jaxrs:providers>
            <jaxrs:inInterceptors>
                <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
            </jaxrs:inInterceptors>         
            <jaxrs:outInterceptors>
                <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
            </jaxrs:outInterceptors>            
    </jaxrs:client>

</beans>

这是堆栈跟踪:

    ERROR [localhost-startStop-1] [ContextLoader] Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:/META-INF/spring/integration/avengers-hulc-flow-context.xml]
Offending resource: URL [file:/xyz/abc/.../WEB-INF/classes/META-INF/spring/integration/avengers-flow-context.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/xyz/abc/.../WEB-INF/classes/META-INF/spring/integration/avengers-hulc-flow-context.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.setFactoryBean(Ljava/lang/String;Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:248)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:199)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:141)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:542)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/xyz/abc/.../WEB-INF/classes/META-INF/spring/integration/avengers-hulc-flow-context.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.setFactoryBean(Ljava/lang/String;Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:242)
        ... 32 more
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.setFactoryBean(Ljava/lang/String;Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
        at org.apache.cxf.configuration.spring.AbstractFactoryBeanDefinitionParser.doParse(AbstractFactoryBeanDefinitionParser.java:136)
        at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
        at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:60)
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1424)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1414)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:187)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:141)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
        ... 37 more
 INFO  [localhost-startStop-1] [support.XmlWebApplicationContext] Closing Root WebApplicationContext: startup date [Wed Dec 10 08:30]; root of context hierarchy
 WARN  [localhost-startStop-1] [support.XmlWebApplicationContext] Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Wed Dec 10 08:30]; root of context hierarchy
        at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:882)
        at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:843)
        at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
        at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5033)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5685)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
 WARN  [localhost-startStop-1] [support.XmlWebApplicationContext] Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Wed Dec 10 08:30]; root of context hierarchy
        at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:359)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:890)
        at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:843)
        at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
        at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5033)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5685)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

的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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.marvel.avengers</groupId>
  <artifactId>ultron-web-alert-rt</artifactId>
  <version>2015.02.0</version>
  <packaging>war</packaging>
  <name>ultron-web-alert-rt</name>

    <properties>    
        <activemq.version>5.8.0</activemq.version>  
        <spring.version>4.0.7.RELEASE</spring.version>
        <spring.integration.version>4.0.4.RELEASE</spring.integration.version>
        <log4j.version>1.2.17</log4j.version>
        <junit.version>4.11</junit.version>
        <xmlbeans.version>2.6.0</xmlbeans.version>
        <commons.codec.version>20041127.091804</commons.codec.version>
        <ibm-mq.version>7.1.0.2</ibm-mq.version>
        <servlet.version>3.0.1</servlet.version>
        <cassandra.version>2.0.8</cassandra.version>
        <datastax.version>2.0.5</datastax.version>
        <jackson.version>1.9.13</jackson.version>
        <jasypt-spring.version>1.9.0</jasypt-spring.version>
        <flume.version>1.4.0</flume.version>
        <drools.version>6.0.1.Final</drools.version>
        <cxf.version>2.7.8</cxf.version>    
        <jaxws.version>2.2.9</jaxws.version>    
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-ci</artifactId>
            <version>${drools.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>netty</artifactId>
                    <groupId>org.jboss.netty</groupId>
                </exclusion>
            </exclusions>                   
        </dependency>
        <dependency>
            <groupId>org.jbpm</groupId>
            <artifactId>jbpm-bpmn2</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>                       
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.version}</version>
            <scope>provided</scope>
        </dependency>       
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ibm</groupId>
            <artifactId>com.ibm.mq</artifactId>
            <version>${ibm-mq.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ibm</groupId>
            <artifactId>com.ibm.mq.jmqi</artifactId>
            <version>${ibm-mq.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ibm</groupId>
            <artifactId>com.ibm.mqjms</artifactId>
            <version>${ibm-mq.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ibm</groupId>
            <artifactId>disthub2.dhbcore</artifactId>
            <version>${ibm-mq.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-all</artifactId>
          <version>${activemq.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>javax.resource</groupId>
          <artifactId>connector</artifactId>
          <version>1.0</version>        
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-jmx</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>       
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-jms</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-stream</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-xml</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-core</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>${jackson.version}</version>
        </dependency>               
        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt</artifactId>
            <version>${jasypt-spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt-spring31</artifactId>
            <version>${jasypt-spring.version}</version>
        </dependency>       
        <dependency>
            <groupId>org.apache.cassandra</groupId>
            <artifactId>cassandra-all</artifactId>
            <version>${cassandra.version}</version> 
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>            
                </exclusion>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>servlet-api</artifactId>            
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.jackson</groupId>
                    <artifactId>jackson-core-asl</artifactId>           
                </exclusion>    
                <exclusion>
                    <groupId>org.apache.cassandra.deps</groupId>
                    <artifactId>avro</artifactId>           
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty</artifactId>          
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>          
                </exclusion>                 
            </exclusions>                   
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>      
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http-jetty</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>${jaxws.version}</version>
        </dependency>                                       
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <packagingExcludes>
                        WEB-INF/lib/com.ibm.mq-7.1.0.2.jar,
                        WEB-INF/lib/com.ibm.mq.jmqi-7.1.0.2.jar,
                        WEB-INF/lib/com.ibm.mqjms-7.1.0.2.jar,
                        WEB-INF/lib/disthub2.dhbcore-7.1.0.2.jar,
                        WEB-INF/lib/javax.jms-7.1.0.2.jar
                    </packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency> 
                <groupId>com.google.guava</groupId> 
                <artifactId>guava</artifactId> 
                <version>14.0.1</version> 
            </dependency>
            <dependency> 
                <groupId>io.netty</groupId> 
                <artifactId>netty</artifactId> 
                <version>3.9.0.Final</version> 
            </dependency>       
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.2</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>1.7.2</version>
            </dependency>
        </dependencies>
    </dependencyManagement>     
</project>

4 个答案:

答案 0 :(得分:3)

将CXF升级到2.7.8版。 CXF 3.X是第一个与Spring 4一起使用(并进行测试)的版本。

如果您查看Apache CXF JAR中的清单(META-INF / MANIFEST.MF),您会发现它支持最多但不包括Spring 4.0。以下行取自最新的2.7版本:

org.springframework.beans;resolution:=optional;version="[2.5,4)"

答案 1 :(得分:0)

  1. 运行mvn dependency:tree
  2. 找出(grep)树中的所有spring版本。 90%你会发现其他家属使用不兼容的版本。
  3. 更新这些家属或排除其中的春天

答案 2 :(得分:0)

看起来像文件夹结构错误。由于 META-INF 包含我们应用程序的 META 数据,因此META-INF必须是 WEB-INF 的parellel。它不应出现在文件夹

之后

答案 3 :(得分:0)

(正如评论中的原始海报所述)

在Spring 4中删除了BeanDefinitionBuilder.setFactoryBean方法。 从setFactoryBean

明确调用avengers-hulc-flow-context.xml

在堆栈跟踪中,显示为

nested exception is java.lang.NoSuchMethodError:
org.springframework.beans.factory.support.BeanDefinitionBuilder.setFactoryBean(Ljava/lang/String;Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)

违规调用是由cxf进行的,因此您使用的cxf版本与弹簧4不兼容。(如Jeff所说。)

org.apache.cxf.configuration.spring.AbstractFactoryBeanDefinitionParser.doParse(AbstractFactoryBeanDefinitionParser.java:136)

http://cxf.apache.org/docs/30-migration-guide.html可能有用,可以迁移到cxf 3。