if (!jndiInitialized) {
// add our configuration to JNDI
JNDIMain.initialize(props);
jndiInitialized = true;
}
WebAppCollection webapps = getWebAppCollection(props);
if (webapps == null) {
return;
}
String classpath = PropertiesUtil.getAliasedProperty(props, "classpath", null);
if (classpath != null) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl != null && cl instanceof URLClassLoader) {
URLClassLoader urlcl = (URLClassLoader) cl;
urlcl = new URLClassLoader(classpathToUrls(classpath), urlcl);
Thread.currentThread().setContextClassLoader(urlcl);
}
}
ServletEngineFactory engineFactory
= JNDIMain.lookup(ServletEngineFactory.class);
ServletEngine engine = engineFactory.createServletEngine(
webapps, new ServletEngineConfigurationImpl(props));
webapps.startAll();
engine.run();
}