You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Honi Jain (JIRA)" <ji...@apache.org> on 2007/05/17 12:56:34 UTC

[jira] Created: (SM-952) ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml

ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml
---------------------------------------------------------------------------

                 Key: SM-952
                 URL: https://issues.apache.org/activemq/browse/SM-952
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-common
    Affects Versions: 3.2
            Reporter: Honi Jain
            Priority: Critical
             Fix For: 3.2
         Attachments: ClassLoaderXmlPreprocessor.java

If we dont specify location child node but specify library child node of parent node classpath in xbean.xml we are getting Null Pointer Exception when we deploy our service assembly in servicemix.

getClassLoader method of ClassLoaderXmlPreprocessor  parses the xbean.xml for the tag 'classpath'. For loading shared-libraries it searches for the child nodes with tag name 'library'.  After it found all the child library nodes it adds to the arraylist for the shared library using the child node list of 'location'. This will give null pointer exception if no location node is there. Even if location node is present when the code will try to look for shared library it will give an error.

I am attaching the patch file ClassLoaderXmlPreprocessor  .java

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


[jira] Updated: (SM-952) ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml

Posted by "ahornbeck (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ahornbeck updated SM-952:
-------------------------

    Attachment: ClassLoaderXmlPreprocessor.java.patch

It looks like Honi provieded the fix in his original post.  Here is a patch using his file.

The fix is  'libraryElement.getFirstChild())...' instead of 'locationElement.getFirstChild())...'.

> ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml
> ---------------------------------------------------------------------------
>
>                 Key: SM-952
>                 URL: https://issues.apache.org/activemq/browse/SM-952
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-common
>    Affects Versions: 3.2
>            Reporter: Honi Jain
>            Priority: Critical
>             Fix For: 3.2
>
>         Attachments: ClassLoaderXmlPreprocessor.java, ClassLoaderXmlPreprocessor.java.patch
>
>
> If we dont specify location child node but specify library child node of parent node classpath in xbean.xml we are getting Null Pointer Exception when we deploy our service assembly in servicemix.
> getClassLoader method of ClassLoaderXmlPreprocessor  parses the xbean.xml for the tag 'classpath'. For loading shared-libraries it searches for the child nodes with tag name 'library'.  After it found all the child library nodes it adds to the arraylist for the shared library using the child node list of 'location'. This will give null pointer exception if no location node is there. Even if location node is present when the code will try to look for shared library it will give an error.
> I am attaching the patch file ClassLoaderXmlPreprocessor  .java

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


[jira] Commented: (SM-952) ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml

Posted by "Srivatsan Sridharan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40135 ] 

Srivatsan Sridharan commented on SM-952:
----------------------------------------

Adding comment here as it is a related issue:

When the <library> element provided under <classpath> has a value, the following code snippet to get the SharedLibrary sl returns "null" if the shared library is not installed and throws NPE when sl.getClassLoader() is called. A typical scenario when this could occur is when running maven junit test cases for a su that references a shared-library in the xbean.xml/servicemix.xml. 
         
           // create the classloader
            List<ClassLoader> parents = new ArrayList<ClassLoader>();
            parents.add(getParentClassLoader(applicationContext));
            for (String library : sls) {
                SharedLibrary sl = container.getRegistry().getSharedLibrary(library);
                // Check for null to prevent the NPE
                if ((sl != null) && (sl.getClassLoader() != null)) {
                	parents.add(sl.getClassLoader());
		}
            }
A check for null (as shown in the code) prevents the NPE that is thrown.

> ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml
> ---------------------------------------------------------------------------
>
>                 Key: SM-952
>                 URL: https://issues.apache.org/activemq/browse/SM-952
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-common
>    Affects Versions: 3.2
>            Reporter: Honi Jain
>            Priority: Critical
>             Fix For: 3.2
>
>         Attachments: ClassLoaderXmlPreprocessor.java, ClassLoaderXmlPreprocessor.java.patch
>
>
> If we dont specify location child node but specify library child node of parent node classpath in xbean.xml we are getting Null Pointer Exception when we deploy our service assembly in servicemix.
> getClassLoader method of ClassLoaderXmlPreprocessor  parses the xbean.xml for the tag 'classpath'. For loading shared-libraries it searches for the child nodes with tag name 'library'.  After it found all the child library nodes it adds to the arraylist for the shared library using the child node list of 'location'. This will give null pointer exception if no location node is there. Even if location node is present when the code will try to look for shared library it will give an error.
> I am attaching the patch file ClassLoaderXmlPreprocessor  .java

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


[jira] Resolved: (SM-952) ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet resolved SM-952.
--------------------------------

    Resolution: Fixed
      Assignee: Guillaume Nodet

Sending        common/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java
Transmitting file data .
Committed revision 579963.

> ClassLoaderXmlPreprocessor not able to load shared libraries from xbean.xml
> ---------------------------------------------------------------------------
>
>                 Key: SM-952
>                 URL: https://issues.apache.org/activemq/browse/SM-952
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-common
>    Affects Versions: 3.2
>            Reporter: Honi Jain
>            Assignee: Guillaume Nodet
>            Priority: Critical
>             Fix For: 3.2
>
>         Attachments: ClassLoaderXmlPreprocessor.java, ClassLoaderXmlPreprocessor.java.patch
>
>
> If we dont specify location child node but specify library child node of parent node classpath in xbean.xml we are getting Null Pointer Exception when we deploy our service assembly in servicemix.
> getClassLoader method of ClassLoaderXmlPreprocessor  parses the xbean.xml for the tag 'classpath'. For loading shared-libraries it searches for the child nodes with tag name 'library'.  After it found all the child library nodes it adds to the arraylist for the shared library using the child node list of 'location'. This will give null pointer exception if no location node is there. Even if location node is present when the code will try to look for shared library it will give an error.
> I am attaching the patch file ClassLoaderXmlPreprocessor  .java

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