Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2492

Classloader issue in OSGi environment

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 5.2.0.M1
    • 5.0.1.FINAL
    • drools-core (expert)
    • 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

          Activity

            People

              mproctor@redhat.com Mark Proctor
              smil_jira Cserveny Tamas (Inactive)
              Archiver:
              rhn-support-ceverson Clark Everson

              Dates

                Created:
                Updated:
                Resolved:
                Archived:

                PagerDuty