try
{
MBeanServer mbeanServer = createMBeanServer("jboss");
try
{
ServiceController serviceController = new ServiceController();
ObjectName objectName = new ObjectName("jboss.system:service=ServiceController");
mbeanServer.registerMBean(serviceController, objectName);
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);
MainDeployerImpl mainDeployer = new MainDeployerImpl();
mainDeployer.setStructuralDeployers(new StructuralDeployers()
{
public DeploymentContext determineStructure(Deployment deployment) throws DeploymentException