LinkageError when trying to call CXF / SOAP web service
I have a project (like myproject) where I hosted a CXF RESTful service and a CXF WS / SOAP service and am working on JBoss (6.0.0.FINAL). The RESTful interface is used by all of our back-end systems, and the SOAP interface is used by third-party systems (as a callback interface).
The following urls are working fine.
-
REST URL:
http://localhost:8080/myproject/internal/someOperation
(content-type: application/json
and POST body) -
SOAP WSDL:
http://localhost:8080/myproject/cbsoap?wsdl
Now my problem is that the actual SOAP calls failed. I am using SOAPUI to try SOAP calls, but just to request WSDL. I am getting the following error: -
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)
source to share
I finally solved the problem, but this is really weird.
- I added cxf-rt-frontend-jaxws and cxf-bundle-rs as dependencies and mark some exceptions -> jetty-server, gernomino-servlet.
- I had beans.xml in the WEB-INF folder, but I had to place it under src / main / resources. The beans.xml are supposed to be on the classpath, not WEB-INF.
Thank you for your responses.
source to share
LinkageError
JBoss is usually caused by your application packaging its own copies of certain libraries that JBoss considers limited. Usually these are things in packages java.*
and javax.*
.
After looking at the stack trace, I guess the culprit is javax.activation.DataHandler
. Check the JAR files associated with your application to make sure they don't contain anything similar. If so, delete it.
It may not be javax.activation.DataHandler
, but it may be something that it depends on.
source to share