Search code examples
jaxbwebspherejax-wsmoxy

Why is taking too long to respond to Websphere the first time I invoke a SOAP Web Service (JAX-WS)?


I am using Websphere 8.5.5 and I've noted that my first call to a JAX-WS Web Services takes too long to respond. I get this in the LOG (trace level) and after 15 mins it works. I have EclipseLink MOXy as a JAXB provider

jaxb.properties:

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory

javax.xml.bind.JAXBException:

Exception Description: Name collision.  Two classes have the XML type with uri http://www.w3.org/2001/XMLSchema and name string.
 - with linked exception:
[Exception [EclipseLink-50007] (Eclipse Persistence Services - 2.4.2.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Name collision.  Two classes have the XML type with uri http://www.w3.org/2001/XMLSchema and name string.]

Solution

  • Well, after a lot of research I've found that it seems to be a bug of Websphere because it adds some array classes to the JAXB Context for example (byte[], int[], String[]) the problem is that when it adds String[] to the list of classes for the JAXB Context MOXy can't handle and gives that error.

    The good news is that it can be solved by adding a custom property into the "Generic JVM arguments" since Websphere >= 8.5.5.2

    Servers > Server Types > WebSphere application servers > server_name > Java and Process Management > Process definition > Java Virtual Machine >Generic JVM arguments

    -Dcom.ibm.websphere.webservices.jaxwsOptimizeLevelOne=true
    

    In the following resources it doesn't say it does that but after checking JAXBContext creation in EclipseLink you can see that it doesn't send anymore those array classes thus solving the problem.

    More information on this:

    https://publib.boulder.ibm.com/httpserv/cookbook/WebSphere_Application_Server-WAS_Classic-Web_Services.html

    http://www-01.ibm.com/support/docview.wss?uid=swg1PI14203

    Log trace to detect how much time it takes to create JAXBContext on Websphere can be activated specifying this log level:

    com.ibm.ws.websvcs.JAXBContextTrace=all
    

    [7/7/16 16:34:28:908 CDT] 00000089 JAXBContextTr 3 org.apache.axis2.jaxws.message.databinding.JAXBUtils getJAXBContext new JAXBContext constructed, elapsed time msec: 1035