Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1596

DynamicClientFactory.setupClasspath throws a null pointer exception if classloader does not contain jars

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.1, 2.0.7
    • Component/s: JAXB Databinding
    • Labels:
      None
    • Environment:

      Websphere 6.1.0.7, jdk 1.5.09, Solaris

    • Estimated Complexity:
      Novice

      Description

      On WAS, one of the ExtClassCloader returns a null instead of an empty array when getUrls is called.

      Stack trace:
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:215)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:150)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:129)
      at mil.af.ilss.common.service.WebServiceUtil.invokeWebService(WebServiceUtil.java:43)
      ... 1 more
      Caused by: java.lang.NullPointerException
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.setupClasspath(DynamicClientFactory.java:404)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:213)

      The following is the list of classloaders in order:
      com.ibm.ws.classloader.CompoundClassLoader Delegation Mode: PARENT_FIRST
      com.ibm.ws.classloader.JarClassLoader Delegation mode: PARENT_LAST
      com.ibm.ws.classloader.ProtectionClassLoader
      com.ibm.ws.bootstrap.ExtClassLoader

      The following code should fix the issue. setupClasspath method line 402:

      if (tcl instanceof URLClassLoader) {
      URL[] urls = ((URLClassLoader)tcl).getURLs();
      if (urls != null) {
      for (URL url : urls) {
      if (url.getProtocol().startsWith("file")) {
      File file;
      try

      { file = new File(url.toURI().getPath()); }

      catch (URISyntaxException urise)

      { file = new File(url.getPath()); }

      if (file.exists()) {
      classPath.append(file.getAbsolutePath())
      .append(System
      .getProperty("path.separator"));

      if (file.getName().endsWith(".jar"))

      { addClasspathFromManifest(classPath, file); }


      }
      }
      }
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              uwodi Alton Idowu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: