[ 
https://issues.apache.org/jira/browse/CXF-1596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-1596.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.1
         Assignee: Daniel Kulp

> DynamicClientFactory.setupClasspath throws a null pointer exception if 
> classloader does not contain jars
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1596
>                 URL: https://issues.apache.org/jira/browse/CXF-1596
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.1
>         Environment: Websphere 6.1.0.7, jdk 1.5.09, Solaris
>            Reporter: Alton Idowu
>            Assignee: Daniel Kulp
>             Fix For: 2.1.1
>
>
> 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); 
>                                   }                         
>                               }     
>                           }
>                       }
>                 }
>             }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to