本文整理了Java中org.apache.catalina.startup.Bootstrap
类的一些代码示例,展示了Bootstrap
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap
类的具体详情如下:
包路径:org.apache.catalina.startup.Bootstrap
类名称:Bootstrap
[英]Bootstrap loader for Catalina. This application constructs a class loader for use in loading the Catalina internal classes (by accumulating all of the JAR files found in the "server" directory under "catalina.home"), and starts the regular execution of the container. The purpose of this roundabout approach is to keep the Catalina internal classes (and any other classes they depend on, such as an XML parser) out of the system class path and therefore not visible to application level classes.
[中]
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Load the Catalina daemon.
* @param arguments Initialization arguments
* @throws Exception Fatal initialization error
*/
public void init(String[] arguments)
throws Exception {
init();
load(arguments);
}
代码示例来源:origin: stackoverflow.com
Bootstrap boot = context.getBean(Bootstrap.class);
boot.start();
代码示例来源:origin: t7mp/maven-t7-plugin
@Override
public void stop() {
try {
bootstrap.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
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);
}
}
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
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);
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
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);
代码示例来源:origin: org.glassfish.main.web/web-core
setCatalinaHome();
setCatalinaBase();
initClassLoaders();
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* 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);
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* 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;
}
代码示例来源:origin: t7mp/maven-t7-plugin
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);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
/**
* Get the value of the catalina.base environment variable.
*/
public static String getCatalinaBase() {
return System.getProperty(Globals.CATALINA_BASE_PROP, getCatalinaHome());
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* 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;
}
代码示例来源:origin: t7mp/maven-t7-plugin
protected Bootstrap getBootstrap() {
return new Bootstrap();
}
代码示例来源:origin: org.glassfish.main.web/web-core
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);
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
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);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
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);
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
setCatalinaHome();
setCatalinaBase();
initClassLoaders();
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
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);
}
}
代码示例来源:origin: org.glassfish.main.web/web-core
/**
* 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);
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* 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;
}
内容来源于网络,如有侵权,请联系作者删除!