我有一个针对IBM WebSphere JRE编译的JAX-WS Web服务,该服务似乎与使用JBoss7预先安装/配置的cxf堆栈不兼容,但与WebSphere / Axis2一起使用。我不确定为什么我看到这种不兼容性,因为我没有使用任何Axis2特定的类(我只使用javax.ws类),但是,我得到类不兼容问题。
我的课程没有直接依赖Axis2,这就是为什么我期望这个服务可以用cxf查找,但显然不是。我只使用javax.xml.ws.WebServiceContext
和javax.xml.ws.handler.soap.SOAPMessageContext
。
为了安全起见,我已经浏览了所有我的pacakged jar文件,并且没有在任何地方找到javax.xml.ws.handler.soap.SOAPMessageContext。哪个好,因为它属于JRE。这让我相信我的JRE(IBM JRE)提供的javax.xml.ws与CXF堆栈之间存在不兼容性。
因此,我想我会尝试针对Axis2堆栈运行该服务,但我不知道如何在JBoss7下安装它。
如果有人能帮我理解不兼容性和/或如何让Axis2与JBoss7一起工作,我将不胜感激。
完整堆栈跟踪:
11:39:02,121 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-0.0.0.0-0.0.0.0-8080-1) Application {http://www.com/ClientServices/LendingSimulation/V1.2}LendingSimulationService#{http://www.com/ClientServices/LendingSimulation/V1.2}calculateBorrowingData has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: org.apache.cxf.jaxws.context.WrappedMessageContext incompatible with javax.xml.ws.handler.soap.SOAPMessageContext
at org.jboss.wsf.stack.cxf.JBossWSInvoker.createFault(JBossWSInvoker.java:234)
at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:189)
at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:117)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:452) [:6.0]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314) [:6.0]
at java.util.concurrent.FutureTask.run(FutureTask.java:149) [:6.0]
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)
at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:162)
at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:138) [jbossws-spi-2.0.0.Beta7.jar:2.0.0.Beta7]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at java.lang.Thread.run(Thread.java:735) [:6.0]
Caused by: java.lang.ClassCastException: org.apache.cxf.jaxws.context.WrappedMessageContext incompatible with javax.xml.ws.handler.soap.SOAPMessageContext
at com.clientservices.lendingsimulation.util.SoapUtil.extractServiceContextFromHeader(SoapUtil.java:43) [classes:]
at com.clientservices.lendingsimulation.service.LendingSimulationServiceImpl.calculateBorrowingData(LendingSimulationServiceImpl.java:112) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) [:6.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) [:6.0]
at java.lang.reflect.Method.invoke(Method.java:599) [:6.0]
at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:111)
at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:169)
... 33 more
谢谢!
埃里克
答案 0 :(得分:0)
解释可以在https://issues.jboss.org/browse/AS7-4201
找到Alessio Soldano解释了在bean中注入WebServiceContext
@Resource WebServiceContext webServiceContext;
....
webServiceContext.getMessageContext() <--This is MessageContext not SOAPMessageContext.
返回SOAPMessageContext所需的唯一位置是webServiceContext.getMessageContext()在SOAPHandler中(在处理程序链中配置)
在您的代码中,webServiceContext.getMessageContext()返回由CXF specfic code(org.apache.cxf.jaxws.context.WrappedMessageContext)实现的MessageContext。