Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5205

JAXWS : Problem loading JAXB classes from a directory which has spaces in its name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.6.1
    • None
    • jaxws
    • None
    • OS : Windows XP
      Server : WebSphere 8.0.0.1
      Axis 2 : 1.6.1

    Description

      In my case, I have a JAXWS service packaged inside MyService.jar. It requires two supporting jars (model.jar, rules.jar), these jars are also packaged inside MyService.jar (under lib folder).

      I am trying to deploy this web service in WebSphere 8.0.0.1 using axis web application. I have placed this MyService.jar inside "servicejars" folder as set and required by Axis2 JAX-WS deployment.

      After all recommended setting of classloader and disabling WebSphere supplied JAXWS engine, I was able to deploy my service properly, however when client tries to execute a call it receives following exception -

      Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: javax.xml.bind.JAXBException: com.xxx.Message is not known to this context
      at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
      at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
      at $Proxy31.process(Unknown Source)
      at com.xxx.MainClient.main(MainClient.java:46)

      I did some debugging based on this message to know why required classes are no there in JAXB context. Seems like problem is with org.apache.axis2.jaxws.message.databinding.impl.ClassFinderImpl. The method getClassesFromJarFile(String pkg, ClassLoader cl) is responsible for loading classes for a given package using given class loader. Inside this method, all URLs from classloader are picked and are iterated one by one to find classes of given package.

      During this process, if URL is for a location which has spaces in its name (or in its complete path) then it results in URISyntaxException and no classes are loaded.

      Line throwing exception is : File f = new File(url.toURI().getPath());

      In my case, ClassFinderImpl.getClassesFromJarFile is getting a classloader (as parameter) which has following five values for URLs -

      0 - file:/C:/DOCUME~1/userLOCALS~1/Temp/axis2-tmp-1224404954365087102.tmp/axis23975540858234400924MyService.jar

      1- file:/C:/DOCUME~1/user/LOCALS~1/Temp/axis2-tmp-1224404954365087102.tmp/axis28187536653718477252model.jar

      2- file:/C:/DOCUME~1/user/LOCALS~1/Temp/axis2-tmp-1224404954365087102.tmp/axis28055770004335999009rules.jar

      3- file:/D:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/e669730Node01Cell/axis2_war.ear/axis2.war/WEB-INF/

      4- file:/D:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/e669730Node01Cell/axis2_war.ear/axis2.war/

      When iteration is for forth values, its results in exception (dues to space in "Program Files") and no classes for package are loaded in context.

      I know WebSphere should be installed in directories having no spaces in name but this is existing setup and I have no control to change this currently. And moreover I think this problem is related to ability to handle space in URL by ClassFinderImpl class.

      Thanks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vinsarwate Vinay Sarwate
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: