我是新玩的框架。我需要使用java在play框架中创建一个soap服务。我关注this文章,但无法运行应用程序 - activator/play version - 2.5.4
访问该服务时出现此错误。
[warn] o.s.c.s.ClassPathXmlApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: 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_$TooManyRequests_$eq(Lplay/api/mvc/Results$Status;)V
[error] application -
! @714g94j1n - Internal server error, for (GET) [/service/hello] ->
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_$TooManyRequests_$eq(Lplay/api/mvc/Results$Status;)V]
at play.api.GlobalSettings$.apply(GlobalSettings.scala:229)
at play.api.inject.guice.GuiceApplicationBuilder$$anonfun$1.apply(GuiceApplicationBuilder.scala:99)
at play.api.inject.guice.GuiceApplicationBuilder$$anonfun$1.apply(GuiceApplicationBuilder.scala:99)
at scala.Option.getOrElse(Option.scala:121)
at play.api.inject.guice.GuiceApplicationBuilder.applicationModule(GuiceApplicationBuilder.scala:99)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:158)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:155)
我的代码:
Build.sbt:
name := "play-cxf-hello"
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.7"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
libraryDependencies += "org.springframework" % "spring-context" % "4.3.2.RELEASE"
libraryDependencies += "eu.imind.play" %% "play-cxf_play24" % "1.2.1"
libraryDependencies += "org.apache.cxf" % "cxf-rt-bindings-soap" % "3.1.7"
libraryDependencies += "org.apache.cxf" % "cxf-rt-frontend-jaxws" % "3.1.7"
plugins.sbt:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.4")
applicationContext.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
">
<!-- Import Apache CXF configuration and Play! transport plugin. -->
<import resource="classpath:cxf.xml"/>
<!-- Define Hello World endpoint. It will be available at http://localhost:9000/service/hello -->
<jaxws:endpoint name="helloWorld"
transportId="http://schemas.xmlsoap.org/soap/http"
address="/service/hello"
implementor="services.hello.HelloWorldImpl"/>
</beans>
Global.java:
public class Global extends GlobalSettings {
protected ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
@Override
public void onStart(Application app) {
ctx.start();
}
@Override
public void onStop(Application app) {
ctx.stop();
}
}
有人可以就此提出建议吗?