java – 尝试调用CXF / SOAP Web服务时的LinkageError

我有一个项目(比如myproject),我在其中托管了一个CXF RESTful服务和CXF WS / SOAP服务,并在JBoss(6.0.0.FINAL)上运行. RESTful接口由我们所有内部系统使用,SOAP接口由第三方系统使用(作为回调接口)

以下网址工作正常.

> REST URL:http:// localhost:8080 / myproject / internal / someOperation(content-type:application / json和POST body)
> SOAP WSDL:http:// localhost:8080 / myproject / cbsoap?wsdl

现在我的问题是实际的SOAP调用不成功.我使用SOAPUI来尝试SOAP调用,但只是为了能够查询WSDL.我收到以下错误: –

javax.servlet.ServletException: Servlet execution threw an exception
    org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)

root cause

java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller.getAttachmentAsDataHandler(Ljava/lang/String;)Ljavax/activation/DataHandler;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller, and its superclass loader (instance of ), have different Class objects for the type r used in the signature
    org.apache.cxf.jaxb.JAXBDataBase.getAttachmentUnmarshaller(JAXBDataBase.java:78)
    org.apache.cxf.jaxb.io.DataReaderImpl.createUnmarshaller(DataReaderImpl.java:123)
    org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:156)
    org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
    org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
    org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:191)
    org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
    org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)

解决方法:

LinkageError是JBoss,通常是由你的应用程序打包JBoss认为限制的某些库的副本.这些通常是java.*和javax.*包中的东西.

看看你的堆栈跟踪,我猜测罪魁祸首是javax.activation.DataHandler.检查应用程序的捆绑JAR文件,确保它们中没有类似的东西.如果有,则删除它.

它可能不是javax.activation.DataHandler,但可能是它依赖的东西.

上一篇:java-Apache CXF FaultListener未在cxf总线中注册


下一篇:java-如何为使用WSSJInInterceptor配置的安全性编写WS-SecurityPolicy条目?