try
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
mbeanServer.registerMBean(new JmxCL(loader), new ObjectName("jboss:service=defaultClassLoader"));
BasicBootstrap bootstrap = new BasicBootstrap();
bootstrap.run();
Kernel kernel = bootstrap.getKernel();
AbstractController controller = (AbstractController)kernel.getController();
serviceController.setMBeanServer(mbeanServer);
serviceController.setKernel(kernel);