Search code examples
javasoapjax-wsibm-mobilefirstmobilefirst-adapters

Using jax-ws in MobileFirst server (Liberty server)


We are trying to access SOAP 1.1 Web services from a Java JAX-RS adapter.

We are using a SOAP Client that has been generated from our WSDL.

But when unmarshalling soap fault we get the following exception:

...
Caused by: java.lang.ExceptionInInitializerError
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
    at com.sun.proxy.$Proxy196.rechercherContrats(Unknown Source)
    at fr.sma.prod.adapter.ContratResource.rechercherContrats(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.wink.server.internal.handlers.InvokeMethodHandler.handleRequest(InvokeMethodHandler.java:63)
...
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder$1.run(SOAPFaultBuilder.java:570)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder$1.run(SOAPFaultBuilder.java:566)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createJAXBContext(SOAPFaultBuilder.java:565)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.<clinit>(SOAPFaultBuilder.java:555)
... 94 more

Versions:

********************************************************************************
product = WebSphere Application Server 8.5.5.5 (wlp-1.0.8.cl50520150305-2202)
wlp.install.dir = C:/Users/a10344/.ibm/mobilefirst/7.1.0.00.20150807-0630/server/wlp/
java.home = C:\Program Files\Java\jdk1.7.0_71\jre
java.version = 1.7.0_71
java.runtime = Java(TM) SE Runtime Environment (1.7.0_71-b14)
os = Windows 7 (6.1; amd64) (en_US)
process = 52164@P72302W
********************************************************************************

The jaxb classes for the service are generated with a CXF maven plugin that generates a standard jax-ws/jaxb code.

...
service= javax.xml.ws.Service.create(wsdlUrl,serviceQName);
productionService= service.getPort(ProductionService.class);
productionService.rechercherContrat(...);
...

Thanks,

Milan


Solution

  • Seems like we're unable to use java adapters with soap (Unsolvable Class conflicts with JaxB between JDK and Embedeeded Worklight Jar). Seems like it's an unsolved bug : Now IBM ask us to open an issue send our code to solve the problem. Well, to sum-up : There no solution. We're waiting next version hoping this problem solved.