]
Mark Proctor resolved JBRULES-2449.
-----------------------------------
Fix Version/s: 5.2.0.M1
Resolution: Done
OSGi like ClassLoader problem
-----------------------------
Key: JBRULES-2449
URL:
https://jira.jboss.org/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
Labels: BaseObjectClassFieldReader, ClassLoader, NoDefClassFoundError, OSGi
Fix For: 5.2.0.M1
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.
-
For more information on JIRA, see: