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
ServiceControllerMBean.install(
org.w3c.dom.Element element,
javax.management.ObjectName objectName)
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:
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()))
However this does not work under JBoss 5.x for the class loader naming has been changed.
Could somebody advise a way to get the class loader name under JBoss 5.x?
Thank you in advance