Bootstrap boot = context.getBean(Bootstrap.class); boot.start();
@Override public void stop() { try { bootstrap.stop(); } catch (Exception e) { e.printStackTrace(); } }
private void initClassLoaders() { try { commonLoader = createClassLoader("common", null); if( commonLoader == null ) { // no config file, default to this loader - we might be in a 'single' env. commonLoader=this.getClass().getClassLoader(); } catalinaLoader = createClassLoader("server", commonLoader); sharedLoader = createClassLoader("shared", commonLoader); } catch (Throwable t) { handleThrowable(t); log.error("Class loader creation threw exception", t); System.exit(1); } }
Bootstrap bootstrap = new Bootstrap(); try { bootstrap.init(); } catch (Throwable t) { handleThrowable(t); t.printStackTrace(); return; daemon.load(args); daemon.start(); } else if (command.equals("stopd")) { args[args.length - 1] = "stop"; daemon.stop(); } else if (command.equals("start")) { daemon.setAwait(true); daemon.load(args); daemon.start(); } else if (command.equals("stop")) { daemon.stopServer(args); } else if (command.equals("configtest")) { daemon.load(args); if (null==daemon.getServer()) { System.exit(1); handleThrowable(t); t.printStackTrace(); System.exit(1);
replacement = null; } else if (Globals.CATALINA_HOME_PROP.equals(propName)) { replacement = getCatalinaHome(); } else if (Globals.CATALINA_BASE_PROP.equals(propName)) { replacement = getCatalinaBase(); } else { replacement = System.getProperty(propName);
/** * Start the Catalina daemon. * @throws Exception Fatal start error */ public void start() throws Exception { if( catalinaDaemon==null ) init(); Method method = catalinaDaemon.getClass().getMethod("start", (Class [] )null); method.invoke(catalinaDaemon, (Object [])null); }
/** * Return a File object representing our configuration file. * @return the main configuration file */ protected File configFile() { File file = new File(configFile); if (!file.isAbsolute()) { file = new File(Bootstrap.getCatalinaBase(), configFile); } return file; }
public void startBootstrapInstance(MavenPluginContext pluginContext) { this.log = pluginContext.getLog(); this.configuration = pluginContext.getConfiguration(); List<Stoppable> stoppables = Lists.newArrayList(); getSetupStepSequence().execute(pluginContext); PrintStream originalSystemErr = System.err; bootstrap = getBootstrap(); log.info("Starting Tomcat ..."); try { File catalinaout = new File(configuration.getCatalinaBase(), "/logs/catalina.out"); CatalinaOutPrintStream catalinaOutputStream = new CatalinaOutPrintStream(originalSystemErr, new FileOutputStream(catalinaout), configuration.isSuspendConsoleOutput()); System.setErr(catalinaOutputStream); bootstrap.init(); final BootstrapShutdownHook shutdownHook = new BootstrapShutdownHook(); List<Stoppable> stoppableScanner = ScannerSetup.configureScanners(shutdownHook, configuration, log); stoppables.addAll(stoppableScanner); bootstrap.start(); Runtime.getRuntime().addShutdownHook(shutdownHook); log.info("Tomcat started"); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } stoppables.add(new StoppableBootstrapAdapter(bootstrap)); pluginContext.getMojo().getPluginContext().put(AbstractT7BaseMojo.T7_BOOTSTRAP_CONTEXT_ID, stoppables); }
/** * Get the value of the catalina.base environment variable. */ public static String getCatalinaBase() { return System.getProperty(Globals.CATALINA_BASE_PROP, getCatalinaHome()); }
/** * Initialize daemon. * @throws Exception Fatal initialization error */ public void init() throws Exception { initClassLoaders(); Thread.currentThread().setContextClassLoader(catalinaLoader); SecurityClassLoad.securityClassLoad(catalinaLoader); // Load our startup class and call its process() method if (log.isDebugEnabled()) log.debug("Loading startup class"); Class<?> startupClass = catalinaLoader.loadClass("org.apache.catalina.startup.Catalina"); Object startupInstance = startupClass.getConstructor().newInstance(); // Set the shared extensions class loader if (log.isDebugEnabled()) log.debug("Setting startup class properties"); String methodName = "setParentClassLoader"; Class<?> paramTypes[] = new Class[1]; paramTypes[0] = Class.forName("java.lang.ClassLoader"); Object paramValues[] = new Object[1]; paramValues[0] = sharedLoader; Method method = startupInstance.getClass().getMethod(methodName, paramTypes); method.invoke(startupInstance, paramValues); catalinaDaemon = startupInstance; }
protected Bootstrap getBootstrap() { return new Bootstrap(); }
private void initClassLoaders() { try { ClassLoaderFactory.setDebug(debug); commonLoader = createClassLoader("common", null); if( commonLoader == null ) { // no config file, default to this loader // - we might be in a 'single' env. commonLoader=this.getClass().getClassLoader(); } catalinaLoader = createClassLoader("server", commonLoader); sharedLoader = createClassLoader("shared", commonLoader); } catch (Throwable t) { log.log(Level.SEVERE, LogFacade.CLASS_LOADER_CREATION_EXCEPTION, t); System.exit(1); } }
Bootstrap bootstrap = new Bootstrap(); try { bootstrap.init(); } catch (Throwable t) { handleThrowable(t); t.printStackTrace(); return; daemon.load(args); daemon.start(); } else if (command.equals("stopd")) { args[args.length - 1] = "stop"; daemon.stop(); } else if (command.equals("start")) { daemon.setAwait(true); daemon.load(args); daemon.start(); } else if (command.equals("stop")) { daemon.stopServer(args); } else if (command.equals("configtest")) { daemon.load(args); if (null==daemon.getServer()) { System.exit(1); handleThrowable(t);
replacement = null; } else if (Globals.CATALINA_HOME_PROP.equals(propName)) { replacement = getCatalinaHome(); } else if (Globals.CATALINA_BASE_PROP.equals(propName)) { replacement = getCatalinaBase(); } else { replacement = System.getProperty(propName);
private void initClassLoaders() { try { commonLoader = createClassLoader("common", null); if( commonLoader == null ) { // no config file, default to this loader - we might be in a 'single' env. commonLoader=this.getClass().getClassLoader(); } catalinaLoader = createClassLoader("server", commonLoader); sharedLoader = createClassLoader("shared", commonLoader); } catch (Throwable t) { handleThrowable(t); log.error("Class loader creation threw exception", t); System.exit(1); } }
/** * Start the Catalina daemon. */ public void start() throws Exception { if( catalinaDaemon==null ) init(); Method method = catalinaDaemon.getClass().getMethod("start",(Class[])null); method.invoke(catalinaDaemon, (Object[])null); }
/** * Return a File object representing our configuration file. * @return the main configuration file */ protected File configFile() { File file = new File(configFile); if (!file.isAbsolute()) { file = new File(Bootstrap.getCatalinaBase(), configFile); } return file; }