son't use createMBean() on jmx server as class might not be in the same class loader

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@357174 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2005-12-16 15:54:54 +00:00
parent 0d6f94b93d
commit 634ac91c3d
1 changed files with 7 additions and 1 deletions

View File

@ -309,7 +309,13 @@ public class ManagementContext implements Service {
LocateRegistry.createRegistry(connectorPort);
namingServiceObjectName = ObjectName.getInstance("naming:type=rmiregistry");
mbeanServer.createMBean("mx4j.tools.naming.NamingService", namingServiceObjectName, null);
// Do not use the createMBean as the mx4j jar may not be in the
// same class loader than the server
Class cl = Class.forName("mx4j.tools.naming.NamingService");
mbeanServer.registerMBean(cl.newInstance(), namingServiceObjectName);
//mbeanServer.createMBean("mx4j.tools.naming.NamingService", namingServiceObjectName, null);
// set the naming port
Attribute attr = new Attribute("Port", new Integer(connectorPort));
mbeanServer.setAttribute(namingServiceObjectName, attr);