CXF 和 WebSphere JRE 之间的不兼容性

发布于 2025-01-03 12:34:39 字数 5996 浏览 3 评论 0原文

我有一个针对 IBM WebSphere JRE 编译的 JAX-WS Web 服务,该服务似乎与 JBoss7 预安装/配置的 cxf 堆栈不兼容,但可以与 WebSphere/Axis2 配合使用。我不确定为什么我会看到这种不兼容性,因为我没有使用任何 Axis2 特定类(我只使用 javax.ws 类),但尽管如此,我还是遇到了类不兼容问题。

我的类没有直接依赖于 Axis2,这就是为什么我期望该服务可以与 cxf 一起使用 find,但显然不是。我只使用 javax.xml.ws.WebServiceContext 和 javax.xml.ws.handler.soap.SOAPMessageContext。

为了安全起见,我检查了所有打包的 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

谢谢!

埃里克

I've got a JAX-WS web service compiled against an IBM WebSphere JRE that does not seem to be compatible with the cxf stack that comes preinstalled/configured with JBoss7, but works with WebSphere/Axis2. I am not sure why I am seeing this incompatibility as I am not using any Axis2 specific classes (am only using javax.ws classes), but none the less, I get class incompatibility issues.

My class has no direct dependence on Axis2, which is why I was expecting that the service would work find with cxf, but apparently not. I am only using javax.xml.ws.WebServiceContext and javax.xml.ws.handler.soap.SOAPMessageContext.

Just to be on the safe side, I've gone through all my pacakged jar files and didn't find javax.xml.ws.handler.soap.SOAPMessageContext anywhere. Which is good, since it belongs to the JRE. Which leads me to believe that there is an incompatibility between my the javax.xml.ws provided by my JRE (IBM JRE) and the CXF stack.

Consequently, I figured I would try to run the service against the Axis2 stack, but I have no idea how to install it under JBoss7.

If anyone can help me understand how the incompatibility and/or how to get Axis2 working with JBoss7, I would appreciate it.

Full stack trace:

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

Thanks!

Eric

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪化雨蝶 2025-01-10 12:34:39

说明可以在 https://issues.jboss.org/browse/AS7-4201

Alessio Soldano 解释说在注入 WebServiceContext 的 bean 中,

@Resource WebServiceContext webServiceContext;
....
webServiceContext.getMessageContext() <--This is MessageContext not SOAPMessageContext.

需要 webServiceContext.getMessageContext() 返回 SOAPMessageContext 的唯一位置是在 SOAPHandler 中(在处理程序链中配置)。

在您的代码中,webServiceContext.getMessageContext() 返回由 CXF 特定代码 (org. apache.cxf.jaxws.context.WrappedMessageContext)。

The explaination can be found at https://issues.jboss.org/browse/AS7-4201

Alessio Soldano explains that within the bean injecting the WebServiceContext

@Resource WebServiceContext webServiceContext;
....
webServiceContext.getMessageContext() <--This is MessageContext not SOAPMessageContext.

The only place webServiceContext.getMessageContext() is required to return SOAPMessageContext is in a SOAPHandler (configured in handler-chain)

In your code webServiceContext.getMessageContext() returns a MessageContext as implemented by CXF specfic code (org.apache.cxf.jaxws.context.WrappedMessageContext).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文