玩框架CxfController工厂不起作用

时间:2015-09-27 19:37:57

标签: spring playframework cxf

我使用Play 2.4.3。我想使用play-cxf_play24创建一个soap服务,所以我有一个名为"eu.imind.play" %% "play-cxf_play24" % "1.2.0"的依赖项。并为spring DI设置了一个cxf.xml配置:

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

    <import resource="classpath:META-INF/cxf/cxf.xml"/>

    <bean id="playTransportFactory" class="org.apache.cxf.transport.play.PlayTransportFactory" lazy-init="false">
        <property name="transportIds">
            <list>
                <value>http://cxf.apache.org/transports/play</value>
                <value>http://schemas.xmlsoap.org/soap/http</value>
                <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
            </list>
        </property>
    </bean>

    <bean class="org.apache.cxf.transport.play.CxfController" factory-method="getInstance">
        <property name="transportFactory" ref="playTransportFactory" />
    </bean>
</beans>

现在运行播放应用程序时抛出此错误:

play.api.PlayException: Cannot init the Global object[Error creating bean with name 'org.apache.cxf.transport.play.CxfController#0' defined in class path resource [cxf.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.cxf.transport.play.CxfController$]: Factory method 'getInstance' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.cxf.transport.play.CxfController$.play$api$mvc$Results$_setter_$PaymentRequired_$eq(Lplay/api/mvc/Results$Status;)V]
    at play.api.GlobalSettings$.apply(GlobalSettings.scala:249) ~[play_2.11-2.4.2.jar:2.4.2]
    at play.api.inject.guice.GuiceApplicationBuilder$$anonfun$1.apply(GuiceApplicationBuilder.scala:69) ~[play_2.11-2.4.2.jar:2.4.2]
    at play.api.inject.guice.GuiceApplicationBuilder$$anonfun$1.apply(GuiceApplicationBuilder.scala:69) ~[play_2.11-2.4.2.jar:2.4.2]
    at scala.Option.getOrElse(Option.scala:121) ~[scala-library-2.11.7.jar:na]
    at play.api.inject.guice.GuiceApplicationBuilder.applicationModule(GuiceApplicationBuilder.scala:69) ~[play_2.11-2.4.2.jar:2.4.2]
    at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:126) ~[play_2.11-2.4.2.jar:2.4.2]
    at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93) ~[play_2.11-2.4.2.jar:2.4.2]
    at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21) ~[play_2.11-2.4.2.jar:2.4.2]
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:153) ~[play-server_2.11-2.4.2.jar:2.4.2]
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:150) ~[play-server_2.11-2.4.2.jar:2.4.2]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.transport.play.CxfController#0' defined in class path resource [cxf.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.cxf.transport.play.CxfController$]: Factory method 'getInstance' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.cxf.transport.play.CxfController$.play$api$mvc$Results$_setter_$PaymentRequired_$eq(Lplay/api/mvc/Results$Status;)V
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.cxf.transport.play.CxfController$]: Factory method 'getInstance' threw exception; nested exception is java.lang.AbstractMethodError: org.apache.cxf.transport.play.CxfController$.play$api$mvc$Results$_setter_$PaymentRequired_$eq(Lplay/api/mvc/Results$Status;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver$3.run(ConstructorResolver.java:582) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_60]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
Caused by: java.lang.AbstractMethodError: org.apache.cxf.transport.play.CxfController$.play$api$mvc$Results$_setter_$PaymentRequired_$eq(Lplay/api/mvc/Results$Status;)V
    at play.api.mvc.Results$class.$init$(Results.scala:744) ~[play_2.11-2.4.2.jar:2.4.2]
    at org.apache.cxf.transport.play.CxfController$.<init>(CxfController.scala:14) ~[play-cxf_play23_2.11-1.2.0.jar:1.2.0]
    at org.apache.cxf.transport.play.CxfController$.<clinit>(CxfController.scala) ~[play-cxf_play23_2.11-1.2.0.jar:1.2.0]
    at org.apache.cxf.transport.play.CxfController.getInstance(CxfController.scala) ~[play-cxf_play23_2.11-1.2.0.jar:1.2.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver$3.run(ConstructorResolver.java:582) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]

1 个答案:

答案 0 :(得分:0)

对于play 2.4,你需要play-cxf的1.2.1版,见here