Improve classloader behavior in J2EE container - BaseApplicationDataFactory
---------------------------------------------------------------------------

         Key: DROOLS-489
         URL: http://jira.codehaus.org/browse/DROOLS-489
     Project: drools
        Type: Bug

  Components: all  
    Versions: 2.1, 2.5    
 Environment: Platform - JBoss with scoped classloader enabled. Could affect 
other J2EE containers and applications that uses multiple classloaders.


    Reporter: John Cheng
    Priority: Minor
 Attachments: BaseApplicationDataFactory.java

Specifically, I have an EAR that with a JMX control that executes Drools code. 
The JMX control can be invoked via JBoss' JMX console. This causes an Exception 
as the code for the JMX control is loaded by the EAR classloader -- A 
classloader that is not available to the Jboss's JMX execution thread.

I noticed the code in BaseApplicationDataFactory tries to access the 
Classloader of the "current thread" and only if that is null, then it fallsback 
to the "current class" classloader. This change will tell 
BaseApplicationDataFactory to try another classloader if the first one throws a 
ClassNotFoundException. 

This improves class loading, as we will try both classloaders to see if we can 
load the desired class. 

There are other similar issues such as DROOLS-375. Note I have not attempted to 
provide a general solution to this problem (such as a DroolsClassloader impl).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to