JAX-WS Client JBoss Modules/jboss-deployment-structure.xml Configuration
jfisherdev Sep 12, 2017 11:53 AMI have an EAR application, which is deployed to a standalone WildFly 9.0.2.Final server, in which I want to use a JAX-WS client.
The JAX-WS client is written using standard JAX-WS APIs, so it does not target a specific implementation, and it works as expected when used from a standalone client application. However, when I try to use it in the EAR application, there are class loading and linkage errors when making the client call.
The error information that results when making the client call is given below, but needs a bit of explanation.
The "deployment.wsapp.wsapp-ws.war" module referenced in the error is a different EAR application, which has a web module with JAX-WS endpoints, than the one trying to use the JAX-WS client. It is NOT NECESSARILY the web module with the endpoints the client is targeting; however, whether the client is targeting that application or another one, even one that's on a different server [not necessarily a WildFly server, but a third party web server in some cases], the same error referencing that particular deployment module occurs.
java.lang.LinkageError: Failed to link com/sun/xml/messaging/saaj/soap/SOAPDocumentImpl (Module "deployment.wsapp.wsapp-ws.war:main" from Service Module Loader) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437) at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269) at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77) at org.jboss.modules.Module.loadModuleClass(Module.java:560) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130) at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.<init>(SOAPPartImpl.java:106) at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.<init>(SOAPPart1_1Impl.java:70) at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.getSOAPPart(Message1_1Impl.java:96) Caused by: java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432) ... 90 more Caused by: java.lang.ClassNotFoundException: com.sun.org.apache.xerces.internal.dom.DocumentImpl from [Module "deployment.wsapp.ear.wsapp-ws.war:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
The strange thing to me is that it's referencing the other deployment, even when that deployment isn't the target of the JAX-WS client call. Furthermore, when the EAR isn't present and I'm making a call to a different application or I put the EAR on a different server and have the client target that application it works fine.
One thing that may be worth mentioning is that the deployment, which has JAX-WS endpoints, referenced has references to com.sun.xml.ws.transport.http.servlet.WSServlet and com.sun.xml.ws.transport.http.servlet.WSServletContextListener in the WAR's web.xml, but no com.sun.xml.* references in any code, as well as a sun-jaxws.xml descriptor.
It also contains the following JARs:
- gmbal-api-only.jar
- ha-api.jar
- jaxb-api.jar
- jaxb-core.jar
- jaxb-impl.jar
- jaxb-jxc.jar
- jaxb-xjc.jar
- jaxws-rt.jar
- management-api.jar
- policy.jar
- resolver.jar
- saaj-impl.jar
- stax-ex.jar
- streambuffer.jar
We have been in the process of migrating to WildFly 9 from JBoss AS 4.2.2, and I believe this was done to work around the fact that the JBoss AS 4 configuration we had didn't support container-provided JAX-WS deployment, so it was necessary to basically bring a JAX-WS runtime with each deployment. I would like to get away from bringing these libraries and referencing the com.sun.xml libraries as soon as possible, but I am trying to hold off on making that change for now if possible since we are in a transitional state where backward compatibility with JBoss 4 needs to be maintained for the short term, though I will do it if necessary.
Looking at this guide JBoss Modules and WS applications - WildFly 9 - Project Documentation Editor , my guess is this will come down to JBoss Modules/jboss-deployment-structure.xml configuration or application library packaging, but I'm not sure what exactly needs to be done.
My main questions right now are:
- Is JAX-WS client functionality supported by default or does it require extra configuration? Looking at the article, it sounds like it is supported by default and that module dependency configuration is only necessary when you want to use a specific implementation, but I'm not sure.
- Why is a deployment that isn't necessarily involved in the client call referenced in a Linkage error and possibly causing it? Does this have something to do with the way the endpoints are deployed [use of com.sun.xml classes] that somehow affects which JAX-WS implementation is used?
Any information on this would be very much appreciated.