Details
-
Bug
-
Resolution: Duplicate
-
Major
-
5.0.1.FINAL
-
None
Description
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.
Attachments
Issue Links
- duplicates
-
JBRULES-2351 OSGi ready
- Closed