Context initialization failed after updating Spring Version

二次信任 提交于 2019-12-14 02:50:32

问题


I've recently updated my Spring version from 3.2.4.RELEASE to 4.0.7.RELEASE and since then I'm getting this error while loading context.

Please let me know if I'll have to make any changes to context xml after updating spring version.

Here is the 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" />

Here is 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>

Here is stack-trace:

    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>

回答1:


Upgrade CXF past version 2.7.8. CXF 3.X was the first version to work with (and be tested against) Spring 4.

If you look at the manifest (META-INF/MANIFEST.MF) in the Apache CXF JAR you'll see that it supports up to, but not including Spring 4.0. The following line is taken from latest 2.7 release:

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



回答2:


  1. Run mvn dependency:tree
  2. Find out (grep) all spring versions in the tree. 90% that you'll find incompatible versions used by other dependecies.
  3. Update those dependecies or exclude spring in them



回答3:


Looks like Folder Structure is wrong . META-INF must be parellel to WEB-INF as META-INF contains the META Data for the we application. It should not be present after classes folder




回答4:


(As stated by original poster in a comment)

The BeanDefinitionBuilder.setFactoryBean method has been removed in Spring 4. setFactoryBean is being explicitly called from avengers-hulc-flow-context.xml

In the stacktrace this shows as

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)

The offending call is made by cxf, so the version of cxf you're using is not compatible with spring 4. (Like Jeff says.)

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

http://cxf.apache.org/docs/30-migration-guide.html may be of use migrating to cxf 3.



来源:https://stackoverflow.com/questions/27405498/context-initialization-failed-after-updating-spring-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!