3 Replies Latest reply on Jun 14, 2012 10:39 PM by Elias Ross

    Classloading bug? Locating child plugin resource in parent plugin

    Elias Ross Master

      I have a plugin A that locates and loads resource bundles when the resource does discovery. Based on the properties in the default plugin configuration it will load those resources.


      I have another plugin B which uses classes and resources from A but a different default plugin configuration. Resources in B is attempting to load resources from within plugin B's classpath. So basically we have:


      Plugin A:

         441884  06-12-12 22:21   lib/snmp.jar     9003  06-12-12 22:36   .../snmp/MibComponent.class
           4562  06-12-12 22:36   .../snmp/MibDiscovery.class
           5690  06-13-12 00:24   META-INF/rhq-plugin.xml


      Plugin B:

              0  06-12-12 17:23   mibs/
         151517  06-13-12 00:47   META-INF/rhq-plugin.xml // uses Plugin A's classes
          18944  06-12-12 22:23   mibs/IPV6-ICMP-MIB.mib


      Plugin B configuration:


      <plugin xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration" name="B" displayName="B Plugin">
         <depends plugin="A" useClasses="true"/>
         <service name="B" discovery="MibDiscovery" class="MibComponent" singleton="true">
               <parent-resource-type name="SNMP Component" plugin="snmp" />
               <c:simple-property name="mibs" default="IPV6-ICMP-MIB.mib" />


      This doesn't seem to work on RHQ 4.1. I also tested on 4.4 and it fails.

      I think the work around must be to create a (dummy) class that simply extends MibDiscovery.

      What should happen is a separate class loader get created for 'B Plugin' which will load resources and classes from 'A Plugin' if not found in 'B Plugin'. Let me know if I should file a bug or not. Thanks.