HashMap env = new HashMap();
if( securityDomain != null)
env.put(RMIConnectorServer.AUTHENTICATOR, new JMXConnectorAuthenticator( securityDomain) );
// note: don't pass clientSocketFactory to RMIJRMPServerImpl ctor or JBAS-7933 regression will occur.
rmiServer = new RMIJRMPServerImpl(rmiServerPort, null, serverSocketFactory, env);
JMXServiceURL url = buildJMXServiceURL();
adapter = new RMIConnectorServer(url, env, rmiServer, wrapMBeanServer(mbeanServer));
adapter.start();
url = adapter.getAddress();
registry.rebind(RMI_BIND_NAME, rmiServer.toStub());
registry.rebind(LEGACY_RMI_BIND_NAME, rmiServer.toStub());
if(log.isDebugEnabled()) {
log.debug("started JMXConnector (" + url.toString() + ")" +
(securityDomain!=null ? " domain=" + securityDomain : "") );
}
// For legacy access, bind a JMXAdapter to the JNDI names
Reference reference = new Reference(MBeanServerConnection.class.getName(), JMXAdapter.class.getName(), null);
reference.add(new StringRefAddr("JMXServiceURL", url.toString()));
Util.rebind(context, JNDI_BIND_NAME, reference);
Util.rebind(context, LEGACY_BIND_NAME, reference);
//Object test = Util.lookup(context, JNDI_BIND_NAME, MBeanServerConnection.class);
//log.info("test = " + test);
SecurityFactory.prepare();