More work to get jetty to start

This commit is contained in:
Joakim Erdfelt 2013-08-22 12:45:52 -07:00
parent bddeb8cb77
commit 5b2d9bc825
34 changed files with 67 additions and 342 deletions

View File

@ -1,27 +0,0 @@
#===========================================================
# Configure JVM arguments.
# If JVM args are include in an ini file then --exec is needed
# to start a new JVM from start.jar with the extra args.
# If you wish to avoid an extra JVM running, place JVM args
# on the normal command line and do not use --exec
#
# IF USED, THIS MODULE WILL INVOKE AN EXTRA JVM INSTANCE!!
#-----------------------------------------------------------
--exec
-Xmx2000m
-Xmn512m
-XX:+UseConcMarkSweepGC
-XX:ParallelCMSThreads=2
-XX:+CMSClassUnloadingEnabled
-XX:+UseCMSCompactAtFullCollection
-XX:CMSInitiatingOccupancyFraction=80
# -verbose:gc
# -XX:+PrintGCDateStamps
# -XX:+PrintGCTimeStamps
# -XX:+PrintGCDetails
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -Dorg.apache.jasper.compiler.disablejsr199=true

View File

@ -1,17 +0,0 @@
#===========================================================
# NPN Next Protocol Negotiation
#
# The SPDY and HTTP/2.0 connectors require NPN. The jar for
# NPN cannot be downloaded from eclipse. So the --download
# option is used to install the NPN jar if it does not already
# exist
#
#-----------------------------------------------------------
DEFINE=npn
OPTION=npn
--exec
--download=http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -1,3 +0,0 @@
# Add libraries from lib/ext to the classpath
OPTION=ext

View File

@ -1,9 +0,0 @@
#===========================================================
# JMX Management
#-----------------------------------------------------------
jetty.jmxrmihost=localhost
jetty.jmxrmiport=1099
--exec
-Dcom.sun.management.jmxremote

View File

@ -1,3 +0,0 @@
# Add the resources directory to the classpath
OPTION=resources

View File

@ -1,21 +0,0 @@
#===========================================================
# Default Server Options
# Use the core server jars with websocket on the classpath
# Add the contents of the resources directory to the classpath
# Add jars discovered in lib/ext to the classpath
# Include the core jetty configuration file
#-----------------------------------------------------------
DEFINE=jetty
OPTION=jetty
threads.min=10
threads.max=200
threads.timeout=60000
#jetty.host=myhost.com
jetty.dump.start=false
jetty.dump.stop=false
#jetty.logs=/var/log/jetty
OPTION=Server
etc/jetty.xml

View File

@ -1,8 +0,0 @@
#===========================================================
# JMX Management
#-----------------------------------------------------------
OPTION=jmx
DEPEND=jetty
etc/jetty-jmx.xml

View File

@ -1,6 +0,0 @@
#===========================================================
# Java Server Pages
#-----------------------------------------------------------
OPTION=jsp
DEPEND=jetty

View File

@ -1,11 +0,0 @@
#===========================================================
# stderr/stdout logging.
# The following configuration will redirect stderr and stdout
# to file which is rolled over daily.
#-----------------------------------------------------------
DEPEND=jetty
jetty.log.retain=90
etc/jetty-logging.xml

View File

@ -1,14 +0,0 @@
#===========================================================
# Enable SetUID
# The default user and group is 'jetty' and if you are
# starting as root you must change the run privledged to true
#-----------------------------------------------------------
jetty.startServerAsPrivileged=false
jetty.username=jetty
jetty.groupname=jetty
jetty.umask=002
OPTION=setuid
etc/jetty-setuid.xml

View File

@ -1,18 +0,0 @@
#===========================================================
# SSL Context
# Create the keystore and trust store for use by
# HTTPS and SPDY
#-----------------------------------------------------------
jetty.keystore=etc/keystore
jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
jetty.truststore=etc/keystore
jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
jetty.secure.port=8443
DEPEND=jetty
DEFINE=ssl
OPTION=ssl
etc/jetty-ssl.xml

View File

@ -1,6 +0,0 @@
#===========================================================
# WebSocket Support
#-----------------------------------------------------------
DEPEND=jetty
OPTION=websocket

View File

@ -1,12 +0,0 @@
#===========================================================
# HTTP Connector
#-----------------------------------------------------------
jetty.port=8080
http.timeout=30000
DEPEND=jetty
DEFINE=http
OPTION=http
etc/jetty-http.xml

View File

@ -1,15 +0,0 @@
#===========================================================
# HTTPS Connector
# Must be used with jetty-ssl.xml
#-----------------------------------------------------------
jetty.https.port=8443
EXCLUDE=spdy
DEFINE=https
OPTION=https
DEPEND=ssl
etc/jetty-https.xml

View File

@ -1,12 +0,0 @@
#===========================================================
# SPDY Connector
#-----------------------------------------------------------
jetty.spdy.port=8443
EXCLUDE=https
OPTION=spdy
DEPEND=npn,ssl
etc/jetty-spdy.xml

View File

@ -1,10 +0,0 @@
# ===========================================================
# Enable JAAS
# -----------------------------------------------------------
jaas.login.conf=etc/login.conf
OPTION=jaas
EXCLUDE=demo
etc/jetty-jaas.xml

View File

@ -1,6 +0,0 @@
# ===========================================================
# Enable JNDI
# -----------------------------------------------------------
OPTION=jndi
EXCLUDE=demo

View File

@ -1,6 +0,0 @@
# ===========================================================
# Enable additional webapp environment configurators
# -----------------------------------------------------------
OPTION=plus
etc/jetty-plus.xml

View File

@ -1,11 +0,0 @@
#===========================================================
# Request logger
# Will add a handler to log all HTTP requests to a standard
# request log format file.
#-----------------------------------------------------------
requestlog.retain=90
requestlog.append=true
requestlog.extended=true
etc/jetty-requestlog.xml

View File

@ -1,9 +0,0 @@
# ===========================================================
# Enable servlet 3.1 annotations
# -----------------------------------------------------------
OPTION=annotations
DEPEND=plus
etc/jetty-annotations.xml

View File

@ -1,9 +0,0 @@
#===========================================================
# WebSocket Annotations Support
#-----------------------------------------------------------
DEFINE=websocket-annotations
OPTION=websocket-annotations
DEPEND=websocket
etc/jetty-websockets.xml

View File

@ -1 +0,0 @@
etc/jetty-debug.xml

View File

@ -1 +0,0 @@
etc/jetty-ipaccess.xml

View File

@ -1,13 +0,0 @@
#===========================================================
# Low resource management
#-----------------------------------------------------------
lowresources.period=1050
lowresources.lowResourcesIdleTimeout=200
lowresources.monitorThreads=true
lowresources.maxConnections=0
lowresources.maxMemory=0
lowresources.maxLowResourcesTime=5000
etc/jetty-lowresources.xml

View File

@ -1,7 +0,0 @@
# ===========================================================
# Enable rewrite handler
# -----------------------------------------------------------
OPTION=rewrite
EXCLUDE=demo
etc/jetty-rewrite.xml

View File

@ -1 +0,0 @@
etc/jetty-stats.xml

View File

@ -1,8 +0,0 @@
#===========================================================
# Webapplication Deployer
#-----------------------------------------------------------
DEFINE=deploy
OPTION=deploy
DEPEND=jetty
etc/jetty-deploy.xml

View File

@ -1,4 +1,3 @@
# ===========================================================
# Enable the demonstration web applications
#
@ -6,22 +5,12 @@
# the start.d directory or rename it to not end with ".ini"
# ===========================================================
# The following options are explicitly configured for the demo
# in this file. Thus they cannot be used with the normal
# activation of them
MODULES=jaas,jndi,rewrite,client,annotations,websocket
jaas.login.conf=webapps.demo/test-jaas.d/login.conf
EXCLUDE=jaas,jndi,rewrite
OPTION=jaas,jndi,rewrite,client
etc/jetty-rewrite.xml
etc/jetty-jaas.xml
# Activate the demo options and configurations
OPTION=jndi.demo
MODULES=jndi.demo
etc/jetty-demo.xml
etc/test-realm.xml
DEPEND=ext,resources,http,plus,annotations,websocket-annotations,deploy

View File

@ -57,11 +57,9 @@
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -Dorg.apache.jasper.compiler.disablejsr199=true
#===========================================================
# Default Server Options
# Use the core server jars with websocket on the classpath
@ -69,7 +67,6 @@
# Add jars discovered in lib/ext to the classpath
# Include the core jetty configuration file
#-----------------------------------------------------------
OPTIONS=Server,websocket,resources,ext
threads.min=10
threads.max=200
threads.timeout=60000
@ -77,33 +74,30 @@ threads.timeout=60000
jetty.dump.start=false
jetty.dump.stop=false
etc/jetty.xml
#===========================================================
# JMX Management
# To enable remote JMX access uncomment jmxremote and
# enable --exec
#-----------------------------------------------------------
OPTIONS=jmx
MODULE=jmx
# jetty.jmxrmihost=localhost
# jetty.jmxrmiport=1099
# -Dcom.sun.management.jmxremote
etc/jetty-jmx.xml
#===========================================================
# Java Server Pages
#-----------------------------------------------------------
OPTIONS=jsp
MODULE=jsp
#===========================================================
# Request logger
# Will add a handler to log all HTTP requests to a standard
# request log format file.
#-----------------------------------------------------------
# MODULE=requestlog
# requestlog.retain=90
# requestlog.append=true
# requestlog.extended=true
# etc/jetty-requestlog.xml
#===========================================================
@ -111,29 +105,27 @@ OPTIONS=jsp
# The following configuration will redirect stderr and stdout
# to file which is rolled over daily.
#-----------------------------------------------------------
# MODULE=logging
# jetty.log.retain=90
# etc/jetty-logging.xml
#===========================================================
# Enable SetUID
# The default user and group is 'jetty' and if you are
# starting as root you must change the run privledged to true
#-----------------------------------------------------------
# OPTIONS=setuid
# MODULE=setuid
# jetty.startServerAsPrivileged=false
# jetty.username=jetty
# jetty.groupname=jetty
# jetty.umask=002
# etc/jetty-setuid.xml
#===========================================================
# HTTP Connector
#-----------------------------------------------------------
MODULE=http
jetty.port=8080
http.timeout=30000
etc/jetty-http.xml
#===========================================================
@ -147,15 +139,14 @@ etc/jetty-http.xml
# jetty.truststore=etc/keystore
# jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
# jetty.secure.port=8443
# etc/jetty-ssl.xml
#===========================================================
# HTTPS Connector
# Must be used with jetty-ssl.xml
#-----------------------------------------------------------
MODULE=https
# jetty.https.port=8443
# etc/jetty-https.xml
#===========================================================
@ -176,62 +167,54 @@ etc/jetty-http.xml
# SPDY Connector
# Requires SSL Context and NPN from above
#-----------------------------------------------------------
# OPTIONS=spdy
# MODULE=spdy
# jetty.spdy.port=8443
# etc/jetty-spdy.xml
#===========================================================
# Webapplication Deployer
#-----------------------------------------------------------
etc/jetty-deploy.xml
MODULE=deploy
# ===========================================================
# Enable JAAS
# -----------------------------------------------------------
# OPTIONS=jaas
# MODULE=jaas
# jaas.login.conf=etc/login.conf
# etc/jetty-jaas.xml
# ===========================================================
# Enable JNDI
# -----------------------------------------------------------
# OPTIONS=jndi
# MODULE=jndi
# ===========================================================
# Enable additional webapp environment configurators
# -----------------------------------------------------------
# OPTIONS=plus
# etc/jetty-plus.xml
# MODULE=plus
# ===========================================================
# Enable servlet 3.1 annotations
# -----------------------------------------------------------
# OPTIONS=annotations
# etc/jetty-annotations.xml
# MODULE=annotations
#===========================================================
# Other server features
#-----------------------------------------------------------
# etc/jetty-debug.xml
# etc/jetty-ipaccess.xml
# etc/jetty-stats.xml
# MODULE=debug
# MODULE=ipaccess
# MODULE=stats
#===========================================================
# Low resource managment
#-----------------------------------------------------------
# MODULE=lowresources
# lowresources.period=1050
# lowresources.lowResourcesIdleTimeout=200
# lowresources.monitorThreads=true
# lowresources.maxConnections=0
# lowresources.maxMemory=0
# lowresources.maxLowResourcesTime=5000
# etc/jetty-lowresources.xml
#===========================================================
# The start.d directory contains the active start.ini fragments
start.d/
MODULES=webapp

View File

@ -132,11 +132,14 @@ public class Classpath implements Iterable<File>
try
{
urls[i] = elements.get(i).toURI().toURL();
StartLog.debug("URLClassLoader.url[%d] = %s",i,urls[i]);
}
catch (MalformedURLException e)
{
StartLog.warn(e);
}
}
StartLog.debug("Loaded %d URLs into URLClassLoader",urls.length);
ClassLoader parent = Thread.currentThread().getContextClassLoader();
if (parent == null)

View File

@ -98,12 +98,12 @@ public class CommandLineBuilder
public CommandLineBuilder()
{
this(findJavaBin());
args = new ArrayList<String>();
}
public CommandLineBuilder(String bin)
{
args = new ArrayList<String>();
this();
args.add(bin);
}

View File

@ -90,6 +90,7 @@ public class Main
}
catch (UsageException e)
{
System.err.println(e.getMessage());
usageExit(e.getCause(),e.getExitCode());
}
catch (Throwable e)
@ -244,8 +245,9 @@ public class Main
StartLog.debug("%s - %s",invoked_class,invoked_class.getPackage().getImplementationVersion());
CommandLineBuilder cmd = args.getMainArgs(baseHome);
CommandLineBuilder cmd = args.getMainArgs(baseHome,false);
String argArray[] = cmd.getArgs().toArray(new String[0]);
StartLog.debug("Command Line Args: %s",cmd.toString());
Class<?>[] method_param_types = new Class[]
{ argArray.getClass() };
@ -284,6 +286,8 @@ public class Main
StartLog.debug("jetty.home=%s",baseHome.getHome());
StartLog.debug("jetty.base=%s",baseHome.getBase());
args.addSystemProperty("jetty.home",baseHome.getHome());
args.addSystemProperty("jetty.base",baseHome.getBase());
// ------------------------------------------------------------
// 3) Load Inis
@ -336,10 +340,10 @@ public class Main
// 7) Lib & XML Expansion / Resolution
args.expandModules(baseHome,activeModules);
// 8) Resolve Extra XMLs
args.resolveExtraXmls(baseHome);
return args;
}
@ -423,7 +427,7 @@ public class Main
// Show Command Line to execute Jetty
if (args.isDryRun())
{
CommandLineBuilder cmd = args.getMainArgs(baseHome);
CommandLineBuilder cmd = args.getMainArgs(baseHome,true);
System.out.println(cmd.toString());
}
@ -442,7 +446,7 @@ public class Main
// execute Jetty in another JVM
if (args.isExec())
{
CommandLineBuilder cmd = args.getMainArgs(baseHome);
CommandLineBuilder cmd = args.getMainArgs(baseHome,true);
ProcessBuilder pbuilder = new ProcessBuilder(cmd.getArgs());
final Process process = pbuilder.start();
Runtime.getRuntime().addShutdownHook(new Thread()

View File

@ -60,7 +60,7 @@ public class StartArgs
}
// TODO: might make sense to declare this in modules/base.mod
private static final String SERVER_MAIN = "org.eclipse.jetty.xml.XmlConfiguration.class";
private static final String SERVER_MAIN = "org.eclipse.jetty.xml.XmlConfiguration";
private List<String> commandLine = new ArrayList<>();
private List<String> enabledModules = new ArrayList<>();
@ -89,6 +89,12 @@ public class StartArgs
classpath = new Classpath();
}
public void addSystemProperty(String key, String value)
{
this.systemPropertyKeys.add(key);
System.setProperty(key,value);
}
private void addUniqueXmlFile(String xmlRef, File xmlfile) throws IOException
{
if (!FS.canReadFile(xmlfile))
@ -221,33 +227,38 @@ public class StartArgs
return this.enabledModules;
}
public CommandLineBuilder getMainArgs(BaseHome baseHome) throws IOException
public CommandLineBuilder getMainArgs(BaseHome baseHome, boolean addJavaInit) throws IOException
{
CommandLineBuilder cmd = new CommandLineBuilder();
for (String x : jvmArgs)
if (addJavaInit)
{
cmd.addArg(x);
cmd.addArg(CommandLineBuilder.findJavaBin());
for (String x : jvmArgs)
{
cmd.addArg(x);
}
cmd.addRawArg("-Djetty.home=" + baseHome.getHome());
cmd.addRawArg("-Djetty.base=" + baseHome.getBase());
// Special Stop/Shutdown properties
ensureSystemPropertySet("STOP.PORT");
ensureSystemPropertySet("STOP.KEY");
// System Properties
for (String propKey : systemPropertyKeys)
{
String value = System.getProperty(propKey);
cmd.addEqualsArg("-D" + propKey,value);
}
cmd.addArg("-cp");
cmd.addRawArg(classpath.toString());
cmd.addRawArg(getMainClassname());
}
cmd.addRawArg("-Djetty.home=" + baseHome.getHome());
cmd.addRawArg("-Djetty.base=" + baseHome.getBase());
// Special Stop/Shutdown properties
ensureSystemPropertySet("STOP.PORT");
ensureSystemPropertySet("STOP.KEY");
// System Properties
for (String propKey : systemPropertyKeys)
{
String value = System.getProperty(propKey);
cmd.addEqualsArg("-D" + propKey,value);
}
cmd.addArg("-cp");
cmd.addRawArg(classpath.toString());
cmd.addRawArg(getMainClassname());
// Check if we need to pass properties as a file
if (properties.size() > 0)
{

View File

@ -1 +0,0 @@
<!-- nothing in here, just used to test the start.config logic in ConfigTest.java -->