try
{
// Create the RMI Naming registry
ObjectName naming = new ObjectName("Naming:type=registry");
mserver.createMBean("mx4j.tools.naming.NamingService", naming, null, new Object[] {new Integer(port)}, new String[] {"int"});
NamingServiceMBean nsmbean = (NamingServiceMBean)StandardMBeanProxy.create(NamingServiceMBean.class, mserver, naming);
nsmbean.start();
// Create the JRMP adaptor
ObjectName adaptor = new ObjectName("Adaptor:protocol=JRMP");
mserver.createMBean("mx4j.adaptor.rmi.jrmp.JRMPAdaptor", adaptor, null);
JRMPAdaptorMBean jrmpmbean = (JRMPAdaptorMBean)StandardMBeanProxy.create(JRMPAdaptorMBean.class, mserver, adaptor);