@Override public void contextInitialized(ServletContextEvent event) { try { if (!isInit) { Platform.createComponentLoaderFromWebApplicationContext( WebApplicationContextUtils.getWebApplicationContext(event.getServletContext())); node = Platform.getComponentLoader().getComponent(ManagementNodeManager.class); bus = Platform.getComponentLoader().getComponent(CloudBus.class); node.startNode(); isInit = true; } } catch (Throwable t) { logger.warn("failed to start management server", t); // have to call bus.stop() because its init has been called by spring if (bus != null) { bus.stop(); } Throwable root = ExceptionDSL.getRootThrowable(t); new BootErrorLog().write(root.getMessage()); if (CoreGlobalProperty.EXIT_JVM_ON_BOOT_FAILURE) { System.exit(1); } else { throw new CloudRuntimeException(t); } } }