[jboss-jira] [JBoss JIRA] Created: (JBRULES-2492) Classloader issue in OSGi environment

Tamas Cserveny (JIRA) jira-events at lists.jboss.org
Tue Apr 27 18:05:10 EDT 2010


Classloader issue in OSGi environment
-------------------------------------

                 Key: JBRULES-2492
                 URL: https://jira.jboss.org/jira/browse/JBRULES-2492
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-core  (expert)
    Affects Versions: 5.0.1.FINAL
         Environment: Eclipse RCP (Equinox)
            Reporter: Tamas Cserveny
            Assignee: Mark Proctor
             Fix For: 5.0.2


Drools creates for each property used in a rule file a new class. This class extends a Drools base class called "org.drools.base.extractors.BaseObjectClassFieldReader".

For the creation it will only use the classloader that defined the asserted object, this has an implication: In case the classloader loaded the asserted object does not see the drools-core.jar then it will fail.

Steps to preproduce:

Create two bundles: "drools" and "entities"

Assert an entity with is defined in the "entities" package and use at least one property. 

eg. rule "E!" 
when
    Entity( name == "E!" )
then 
end

Workaround:
Make sure that all classes in drools are visible in the entities. You can do that by:
Add a dependency, Import the packages or by using the buddy loading policy settings.

Desired solution:
Currently the generated class is loaded by the ByteArrayClassLoader. This classloader has one parent defined. The solution should be to set a composite classloader as parent.  This classloader would first try to load the class in the classloader currently set and the would try two other alternatives:
1. the classloader which defined one of the classes in the drools-core.jar
2. the classloader set in the PackafgeBuilder config.

This would ensure that the drools packages would be found correctly without effecting current behaviour.


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

        


More information about the jboss-jira mailing list