[jboss-jira] [JBoss JIRA] Created: (JBRULES-2449) OSGi like ClassLoader problem

Jacopo Torrini (JIRA) jira-events at lists.jboss.org
Fri Mar 12 07:01:37 EST 2010


OSGi like ClassLoader problem
-----------------------------

                 Key: JBRULES-2449
                 URL: https://jira.jboss.org/jira/browse/JBRULES-2449
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-core  (expert)
    Affects Versions: 5.0.1.FINAL
         Environment: kubuntu 9.10
            Reporter: Jacopo Torrini
            Assignee: Mark Proctor


Suppose that we have a OSGi like environment, (a system made of plugins, each of them istantiated in a separated classloader. Each classloader has dependencies on other plugin-classloaders).

Suppose that you have a bundle (plugin) that owns the domain model, another bundle with drools and rules on that domain model. The second plugin depends on the first.
If you try to load the drools rules, drools throws a NoDefClassFoundError for the class org.drools.base.extractors.BaseObjectClassFieldReader.

Investigating on code, I've found that the problem resides on the classloader used to define the pseudoclass that extract field value.
In class org.drools.base.ClassFieldAccessorFactory, line 135, a ByteClassLoader is used to define the new class, but that byteclassloader uses the domain object classloader as parent classloader.
In fact this byteclassloader is created by CacheEntry that is initialized with the domain object classloader, as you can see in line 275 of ClassFieldAccessorCache.

At this point, because the field extractor is defined as a subclass of BaseObjectClassFieldReader defined in drools library, the domain object classloader is unable to find that class and throw the exception metioned above.


-- 
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