5 Replies Latest reply on May 16, 2006 4:57 PM by Ovidiu Feodorov

    ServiceConfigurator bug for scoped dependent services

    Ovidiu Feodorov Master

      org.jboss.system.ServiceConfigurator has a bug that prevents two scoped dependent services deploy correctly. The bug is reproducible by running "ant" in top level directory of the archive attached to the JIRA task (http://jira.jboss.org/jira/browse/JBAS-3226). The only required external setting is the JBOSS_HOME environment variable, that should point to the installation directory of the server instance to test with. The sar will be deployed in $JBOSS_HOME/server/default/deploy.


      This is the description of the example and the bug:

      The service example.Dependent depends on example.Dependency, as shown in the sar's deployment descriptor:

      <server>
      
       <loader-repository>example:name=ScopedLoaderRepository
       <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
       </loader-repository>
      
       <mbean code="example.Dependency"
       name="example:name=Dependency">
       </mbean>
      
       <mbean code="example.Dependent"
       name="example:name=Dependent">
       <depends optional-attribute-name="Dependency"
       proxy-type="attribute">example:name=Dependency</depends>
       </mbean>
      
      </server>


      For a non-scoped configuration, the deployment succeeds.

      For a scoped configuration, the deployment fails with:

      12:21:33,152 INFO [ServiceConfigurator] Problem configuring service example:name=Dependent
      java.lang.ClassNotFoundException: No ClassLoaders found for: example.DependencyMBean
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:198)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:356)
       at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:442)
       ....
      



      The problem is caused by the fact that during Dependent's configuration phase, ServiceConfigurator tries to create an example.Dependency dynamic proxy instance using the current thread context class loader, which is associated with the top level loader repository. A class loader associated with the top level repository has no way of loading a class deployed within a scoped deployment, hence the exception.