Other Servlet Containers

Jenkins is typically run as a standalone application in its own process. The Jenkins WAR file bundles Winstone, a Jetty servlet container wrapper, and can be started on any operating system or platform with a version of Java supported by Jenkins. This is the preferred way to deploy Jenkins and is fully supported.

Theoretically, Jenkins can also be run as a servlet in a traditional servlet container like Apache Tomcat or WildFly, but in practice this is largely untested and there are many caveats. In particular, support for WebSocket agents is only implemented for the Jetty servlet container. See the Servlet Container Support Policy page for details.

Support for traditional servlet containers may be discontinued in the future.

Requirements

  • Jenkins 2.492.3+ requires Servlet API 5.0 (Jakarta EE 9)

  • Compatible containers:

  • Tomcat 10.1.x (Tested with 10.1.40 - latest version)

  • WildFly version needs verification (minimum 30+ recommended)

  • Requires JDK 17+ for full compatibility

Tomcat 10

Deployment

# Download Tomcat 10.1.x
wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.1.40/bin/apache-tomcat-10.1.40.tar.gz

# Extract and deploy
tar xzf apache-tomcat-10.1.40.tar.gz
export CATALINA_HOME=$(pwd)/apache-tomcat-10.1.40
cp jenkins.war $CATALINA_HOME/webapps/

Configuration

Set Jenkins home:

mkdir /var/lib/jenkins
echo "export CATALINA_OPTS=-DJENKINS_HOME=/var/lib/jenkins" > $CATALINA_HOME/bin/setenv.sh
chmod +x $CATALINA_HOME/bin/setenv.sh
Running multiple Jenkins controllers within a single Java process is unsupported.

Scheme selection in redirect URLs is delegated to the servlet container, and Jetty handles the X-Forwarded-For, X-Forwarded-By, and X-Forwarded-Proto headers by default. With Tomcat, one needs to add a Remote IP Valve to expose these headers to Jenkins via the Servlet API. Add the following to ${CATALINA_HOME}/conf/server.xml within the <Host> section:

<Valve className="org.apache.catalina.valves.RemoteIpValve"
       remoteIpHeader="X-Forwarded-For"
       proxiesHeader="X-Forwarded-By"
       protocolHeader="X-Forwarded-Proto" />

WildFly

Requirements

  • WildFly 30+ required for Jenkins 2.492.3+ with JDK 17

  • Uses Servlet API 5.0 (Jakarta EE 9) with jakarta.servlet namespace

  • Incompatible with WildFly 26 and earlier (Servlet API 4.0)

Deployment

cp jenkins.war $JBOSS_HOME/standalone/deployments/

Configuration

# Add this to $JBOSS_HOME/bin/standalone.conf
JAVA_OPTS="$JAVA_OPTS -DJENKINS_HOME=/var/lib/jenkins"
Running multiple Jenkins controllers within a single Java process is unsupported.


Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.