Gerrit binary distributions include a standalone Jetty servlet container, but are packaged as a standard WAR file to permit easy deployment to other existing container installations if using the standalone daemon is not desired.

Gerrit Code Review can be installed into any J2EE servlet container, including popular open source containers such as Jetty or Tomcat, or any commercial server which supports the J2EE servlet specification.


  • Complete the site initialization task described in the standard installation documentation.

  • Stop the embedded daemon that was automatically started by 'init':

      review_site/bin/ stop
  • Deploy the 'gerrit.war' file to your application server.

    The deployment process differs between servers, but typically this can be accomplished by copying 'gerrit.war' into the 'webapps/' subdirectory of the container’s installation.

  • ('Optional') Install Bouncy Castle Crypto API

    If you enabled Bouncy Castle Crypto during 'init', copy the JAR from '$site_path'/lib into your servlet container’s extensions directory so it’s available to Gerrit Code Review.

  • ('Optional') Configure Automatic Site Initialization on Startup

Jetty 7.x

These directions will configure Gerrit as the default web application, allowing URLs like to jump directly to change 4543.

Download and unzip a release version of Jetty. From here on we call the unpacked directory $JETTY_HOME.

If this is a fresh installation of Jetty, move into the installation directory and do some cleanup to remove the sample webapps:

  rm -rf contexts/* webapps/*

Copy Gerrit Code Review into the deployment:

  cp ~/gerrit.war webapps/gerrit.war
  java -jar webapps/gerrit.war cat extra/jetty7/gerrit.xml >contexts/gerrit.xml

Edit '$JETTY_HOME'/contexts/gerrit.xml to correctly configure outgoing SMTP connections.

If OpenID authentication (or certain enterprise single-sign-on solutions) is being used, you may need to increase the header buffer size parameter, due to very long header lines being used by the OpenID authentication handshake process. Add the following to '$JETTY_HOME'/etc/jetty.xml under org.eclipse.jetty.server.nio.SelectChannelConnector:

  <Set name="headerBufferSize">16384</Set>

To start automatically when the system boots, create a start script and modify it for your configuration:

  java -jar webapps/gerrit.war --cat extra/jetty7/ >/etc/init.d/gerrit-jetty
  vi /etc/init.d/gerrit-jetty
Under Jetty, restarting the web application is as simple as touching the context config file: '$JETTY_HOME'/contexts/gerrit.xml

Tomcat 7.x

If a reverse proxy is used in front of Tomcat then see the configuration instructions for encoding slashes. Otherwise Tomcat must be configured to encode slashes, by adding -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true to the CATALINA_OPTS environment variable.

Excerpt from the documentation:

Property org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH:
If this is true '%2F' and '%5C' will be permitted as path delimiters.
If not specified, the default value of false will be used.