title: How to get the class loader ObjectName from a JavaEE application under JBoss 5.x
body: <p>Our JavaEE application has a services which is responsible for installation and start up of other services depending on the configuration stored in a database. Services are installed using the</p>
  
  <pre><code>ServiceControllerMBean.install(
      org.w3c.dom.Element element,
      javax.management.ObjectName objectName)
  </code></pre>
  
  <p>method. This method requires a class loader ObjectName as the second argument. Under JBoss 4.x we used the following hack to get the class loader name:</p>
  
  <pre><code>final ServiceControllerMBean serviceController = 
      (ServiceControllerMBean) MBeanProxy.get(
          ServiceControllerMBean.class,
          ServiceControllerMBean.OBJECT_NAME, server);
  
  final ClassLoader = serviceController.getClass().getClassLoader();
  
  final ObjectName loader = new ObjectName(
      "jmx.loading:UCL=" + Integer.toHexString(classLoader.hashCode()))
  </code></pre>
  
  <p>However this does not work under JBoss 5.x for the class loader naming has been changed.</p>
  
  <p>Could somebody advise a way to get the class loader name under JBoss 5.x?</p>
  
  <p>Thank you in advance</p>