Jetty Logo
Version: 9.3.14.v20161028
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

Quickstart Webapps

Setting up Quickstart
Avoiding TLD Scans with precompiled JSPs
Bypassing start.jar

The auto discovery features of the Servlet specification can make deployments slow and uncertain. Auto discovery of Web Application configuration can be useful during the development of a webapp as it allows new features and frameworks to be enabled simply by dropping in a jar file. However, for deployment, the need to scan the contents of many jars can have a significant impact of the start time of a webapp.

With the release of Jetty 9.2, a quickstart module was included which allows a webapp to be pre-scanned and preconfigured. This means that all the scanning is done prior to deployment and all configuration is encoded into an effective web.xml, called WEB-INF/quickstart-web.xml, which can be inspected to understand what will be deployed before deploying. Not only does the quickstart-web.xml contain all the discovered Servlets, Filters and Constraints, but it also encodes as context parameters all discovered:

With the quickstart mechanism, Jetty is able to entirely bypass all scanning and discovery modes and start a webapp in a predictable and fast way. Tests have shown that webapps that took many seconds to scan and deploy can now be deployed in a few hundred milliseconds.

Setting up Quickstart

To use quickstart the module has to be available to the Jetty instance. In a standard Jetty distribution it can be configured with the following command:

$ java -jar $JETTY_HOME/start.jar --add-to-startd=quickstart

In a Maven project this is done by adding a dependency on the artifact ID jetty-quickstart.


Additionally, for those using Maven, the Jetty Maven Plugin has a goal, jetty:effective-web-xml, which performs quickstart operations. It should be noted, however, that the Jetty Maven Plugin also includes additional items on it’s classpath which may not be needed by the webapp.

Deployed webapps need to be instances of org.eclipse.jetty.quickstart.QuickStartWebApp rather than the normal org.eclipse.jetty.webapp.WebAppContext. If a web application already has a webapps/myapp.xml file, simply change the class in the Configure element. Otherwise, create a webapps/myapp.xml file as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "">
<Configure class="org.eclipse.jetty.quickstart.QuickStartWebApp">
  <Set name="war"><Property name="jetty.webapps" default="."/>/benchmark.war</Set>
  <Set name="contextPath">/benchmark</Set>
  <Set name="autoPreconfigure">true</Set>

For embedded implementations of Jetty, invoking the org.eclipse.jetty.quickstart.PreconfigureQuickStartWar class can be used to configure war files for quickstart deployment. This will create the quickstart-web.xml before the first deployment.

Avoiding TLD Scans with precompiled JSPs

Of course precompiling JSPs is an excellent way to improve the start time of a web application. As of Jetty 9.2 the Apache Jasper JSP implementation has been used and has been augmented to allow the TLD scan to be skipped. This can be done by adding a context-param to the web.xml file (this is done automatically by the Jetty Maven JSPC plugin):


Bypassing start.jar

The Jetty start.jar mechanism is a very powerful and flexible mechanism for constructing a classpath and executing a configuration encoded in Jetty XML format. However, this mechanism does take some time to build the classpath. The start.jar mechanism can be bypassed by using the –dry-run option to generate and reuse a complete command line to start Jetty at a later time:

$ RUN=$(java -jar $JETTY_HOME/start.jar --dry-run)
$ eval $RUN

Note that --dry-run may create a properties file in the temp directory and include it on the generated command line. If so, then a copy of the temporary properties file should be taken and the command line updated with it’s new persistent location.

See an error or something missing? Contribute to this documentation at Github!(Generated: 2016-10-28)