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

OSGi like ClassLoader problem

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

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              mproctor@redhat.com Mark Proctor
              jactor_jboss Jacopo Torrini (Inactive)
              Archiver:
              rhn-support-ceverson Clark Everson

              Dates

                Created:
                Updated:
                Resolved:
                Archived:

                PagerDuty