Requirements

Installation

To install Jenkins on Tomcat, simply copy jenkins.war to $TOMCAT_HOME/webapps, then access http://yourhost/jenkins.

If you are running Tomcat just to host Jenkins, then remove everything from $TOMCAT_HOME/webapps, and place jenkins.war as ROOT.war (Same case is important). Tomcat should expand this and create the ROOT directory, and you should see Jenkins in http://yourhost (if you accepted the Tomcat defaults - http://yourhost:8080) without any additional path. This also works nicely when you set up a virtual host, as it allows a single Tomcat instance to run multiple applications, yet users can still access your jenkins with URLs like http://jenkins.acme.org/ without any additional path. See the Tomcat documentation for more about how to set up a virtual host.

Upgrade

Simply overwrite your jenkins.war with the new version. Tomcat should automatically redeploy the application.

Setting JENKINS_HOME

Before starting Tomcat, set CATALINA_OPTS like this. This can be also used to specify JVM options to increase the heap size:

i18n

Some versions of Tomcat (such as 5.0.28) uses iso-8859-1 to decode URLs, which is in a clear violation of the relevant RFCs. To fix this problem, add the following URIEncoding attribute to the connector definition in $TOMCAT_HOME/conf/server.xml.

Relevant Issues

See the list of issues filed that are specifically marked relevant to Tomcat.

There is also a known issue in Tomcat 6.0.21 to 6.0.26 that may cause some requests to hang.

Tomcat from XAMPP

If you are using XAMPP's tomcat installation, and you have Java > 1.5, then you need to remove the following jars from the common\lib directory, otherwise you will get FileNotFound exceptions from the changelog.xml generator:

xalan.jar
xercesImpl.jar
xercesSamples.jar

Tomcat from Ubuntu

If you get Tomcat from Ubuntu via apt-get, Jenkins will report an error citing the security permission issue. This is because Tomcat in Ubuntu comes with the security manager on by default. This can be disabled by modifying /etc/default/tomcat5 (version number will be different depending on which version of Tomcat you install.) See JENKINS-719 for more details.

Tomcat from Debian

Fix security issues adding the next lines at /etc/tomcat5.5/policy.d/04webapps.policy:

Tomcat from Windows

GUI Testing in Windows

Most Windows services -- including those run with the option "Allow service to interact with desktop" in Windows XP and Vista -- do not have access to many of the computer's resources, including the console display. This may cause Automated GUI Tests to fail if you are running Apache Tomcat as a Windows Service and are doing any GUI testing. This is true at least for AWT and Abbot frameworks. A typical error might look similar to this:

This limitation can be resolved by not running Tomcat as a Windows Service, but instead through a "Scheduled Task" as an Application that runs at logon. There are several options for doing this, an example would be to run "$TOMCAT_HOME\bin\tomcat5.exe". When setting up the scheduled task in Windows Vista consider choosing the check-box for "Run with highest privileges" from the general tab, as this removes the need to always provide administrator privileges and may resolve other issues as well.

*Note: This workaround/fix may or may not require an admin to be logged in during testing. Running your tests while logged in as a standard user this is fine, but some modifications may need to be made for your individual configuration.

I think the Upgrade paragraph is incorrect. Tomcat documentation states:

"If you redeploy an updated WAR file, be sure to delete the expanded directory when restarting Tomcat, so that the updated WAR file will be re-expanded (note that the auto deployer, if enabled, will automatically expand the updated WAR file once the previously expanded directory is removed)."

Unknown User (luca.candela@gmail.com)

One note: windows users might not be aware that ROOT.war is case sensitive, so make sure you rename hudson.war to ROOT.war (and not root.war or Root.war) or it will not work. Just adding this because it took me 20 minutes to figure out what's wrong and might be saving the hassle to the next person with the same problem.

Unknown User (ravenman)

Unknown User (ronoaldo@gmail.com)

Here is a small tutorial to get Hudson 1.352 working under Tomcat 6/Ubuntu 9.10:

Install your Ubuntu Server (This may work with Debian too, not tested yet).

Install the Tomcat Conteiner and the Manager App:

# apt-get install tomcat6 tomcat6-admin

Download Hudson 1.352 war and upload it via your Tomcat Manager Webapp at http://yourserver:8080/manager/html (You may need to add a user under Tomcat to have it running properly. See /etc/tomcat6/tomcat-users.xml):

If you need to enable authentication under Hudson, you need to have the file groovy-1.6.3.jar in Hudson's WEB-INF/lib directory or some erros will apear. I've added it by installing the groovy package, and coping the file to the Hudson webapp directory.

Now, you must configure Tomcat permissions to your Hudson app. Is a good Idea to change the HUDSON_HOME directory too, so when upgrading your install will not delete your settings (CHANGE /home/hudson/ int the following lines to a directory you choose to store Hudson settings and installed plugins. Remember to chown the directory to tomcat6 user, or you may have some probmems!)

First, change the Hudson home directory by adding this settings to your /etc/default/tomcat6 file:

JAVA_OPTS="-DHUDSON_HOME=/home/hudson/" # If you already have other settings in this variable, just add this one separed by whitespaces.

Then, create a file at /etc/tomcat6/policy.d/, named 04hudson.policy, with this contents:

The permissions above will let you install your Hudson plugins (like Jabber IM, and others), and have them working properly. I'm not shure if setting all permissions is a security risk, any one have some tips on that?

Now, restart your Tomcat, and access your running Hudson setup!

# service tomcat6 restart

Notes about this Wiki information:

In the above Wiki, the option CATALINA_OPTS don't work for Tomcat 6, use JAVA_OPTS insted.

The permissions are needed if you change your Hudson home, or the plugins will install, but the may not work properly.

Restarting Hudson via the "Restart when no jobs are running" button (usualy, when installing plugins) causes Tomcat to shutdown! I use the Tomcat Manager web app to restart hudson context, by stopping and starting it again. Is this a bug on Hudson or Tomcat? Is this because of the permissions set to all?

Ubuntu already ships aHudson daemon setup, if you don't need to run it under a Tomcat Conteiner, simply install it by running:

Unknown User (slide.o.mix@gmail.com)

On Windows, if you are running Tomcat as a Windows Service, to set the options for the JVM (like setting CATALINA_OPTS or JAVA_OPTS) use the Tomcat Service Manager. This is either a tray application, or you can run the manager directly via $CATALINA_HOME\bin\tomcat6w.exe, set the options under the "Java" tab and hit "Apply" to apply them. Each options goes on it's own line.

Unknown User (msinghal@in.sopragroup.com)

installation problem with Jenkins.
hello, my problem is:
I've tried to install it suggests: http://pkg.jenkins-ci.org/redhat/
but I have the problem to get access to my web server: HTTP://myhost:8080/jenkins

Error

Unable to create the home directory '/usr/share/tomcat5/.jenkins'. This is most likely a permission problem.

To change the home directory, use JENKINS_HOME environment variable or set the JENKINS_HOME system property. See Container-specific documentation for more details of how to do this.

I'm new at this, and I can not really how to install, please if I could explain in more detail how to perform the installation.

We are using Jenkins V.2.121.3 and tomcat V.8.5.28. And we are seeing frequent GUI hung even the activities are up and running in the individual node(s). We do not have any job in master. Any recommendation for tomcat upgrade !? Additional information JDK V.1.8.0_181 (recently upgraded from V.1.8.0_162).