Documentation for JIRA 4.3. Documentation for other versions of JIRA is available too.

# Installing JIRA on Tomcat 5.5

This section describes how to install JIRA on Tomcat 5.5, a popular open-source server from the Apache Jakarta project.

## Before You Begin

• Please use Tomcat 5.5.15 or higher. All versions of Tomcat effectively leak memory by caching JSPs, which can result in OutOfMemoryErrors if large pages (eg. RSS or Excel) are requested. In 5.5.15+ there is a flag you should set to disable this caching.
• If you are using version 5.5.25 or higher of Tomcat 5, with a MySQL database, you must set up Tomcat to survive connection closures. These versions of Tomcat have been noted to exhibit problems maintaining connections to MySQL databases. Please read this document for details on the changes required.
• Deploying multiple Atlassian applications in a single Tomcat container is not supported. We do not test this configuration and upgrading any of the applications (even for point releases) is likely to break it. There are also a number of known issues with this configuration (see this FAQ for more information).

We also strongly recommend that you do not deploy multiple Atlassian applications in a single Tomcat container for a number of practical reasons. Firstly, you will need to shut down Tomcat to upgrade any application and secondly, if one application crashes, the other applications running in the Tomcat container will be inaccessible.

• The JIRA 'Standalone' download is JIRA preconfigured with a copy of Tomcat 6.0.20. If you have JIRA Standalone, you don't need to follow the steps below.

## 1. Unpack JIRA

Download and unzip JIRA (but not with XP's unzipper nor the default tar utility on Solaris). Ensure that you download the WAR/EAR version, not the Standalone version that is recommended on the Downloads page.
Avoid the Windows XP built-in unzip tool! The built-in unzip tool in Windows XP is broken — it silently fails to extract files with long names (see JRA-2153 ). Other users have also reported problems using WinRAR. Please use another tool like WinZIP to unpack JIRA.
Avoid the Solaris default tar utility! On Solaris, please use GNU tar to unpack JIRA in order to handle long filenames. Do not use the Solaris default tar utility.

A new directory containing JIRA will be created, hereafter referred to as $JIRA_INSTALL. A dedicated user should be created to run JIRA, as JIRA runs as the user it is invoked under and therefore can potentially be abused. Here is an example of how to create a dedicated user to run JIRA in Linux/Solaris: $ sudo /usr/sbin/useradd --create-home --home-dir /usr/local/jira --shell /bin/bash jira

To maximise security, ensure that this user can only write to the JIRA directories (not to the entire file system).

## 2. Configure JIRA

JIRA needs to be told what type of database you'll be using. The database is specified in $JIRA_INSTALL/edit-webapp/WEB-INF/classes/entityengine.xml . Locate the <datasource> tag near the bottom, and change the field-type-name attribute value:  <datasource name="defaultDS" field-type-name="hsql" schema-name="PUBLIC" helper-class="org.ofbiz.core.entity.GenericHelperDAO" check-on-start="true" use-foreign-keys="false" use-foreign-key-indices="false" check-fks-on-start="false" check-fk-indices-on-start="false" add-missing-on-start="true"> <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/JiraDS" /> </datasource> Possible values include cloudscape, db2, firebird, hsql, mckoidb, mysql, mssql, oracle, postgres, postgres72, sapdb, and sybase For PostgreSQL 7.3+, you also need to set a schema-name attribute. Refer to Connecting JIRA to PostgreSQL for details. Also in entityengine.xml , ensure the <transaction-factory>...</transaction-factory> tag contains: <transaction-factory class="org.ofbiz.core.entity.transaction.JNDIFactory"> <user-transaction-jndi jndi-server-name="default" jndi-name="java:comp/env/UserTransaction"/> <transaction-manager-jndi jndi-server-name="default" jndi-name="java:comp/env/UserTransaction"/> </transaction-factory> More details on JIRA's database access layer are available on the EntityEngine configuration page. ### 2.2 Set JIRA Home To specify the location of your JIRA Home Directory (note that you need to do this before you build JIRA), either: • Edit the jira-application.properties file (see the JIRA Installation Directory page to find where this file is located), add a 'jira.home' property and set it to your desired location for the JIRA home directory. Please use forward-slashes ("/"), not back-slashes ("\"). • Set an environment variable named JIRA_HOME in your operating system whose value is the location of your JIRA home directory. To do this: • On Linux/Unix, do one of the following: • Enter the following command at a shell/console prompt before running JIRA: • export JIRA_HOME = /path/to/jira/home • Specify the command above in a script used to start JIRA. • On Windows, do one of the following: • Configure this environment variable through the Windows user interface (typically through 'My Computer' or 'Computer') • Enter the following command at command prompt before running JIRA: • set JIRA_HOME = X:\\path\\to\\jira\‌\home (where X is the drive letter where your JIRA home directory is located) • Specify the command above in a batch file used to start JIRA. You can specify any location on a disk for your JIRA home directory. Please be sure to specify an absolute path. Please note that you cannot use the same JIRA home directory for multiple instances of JIRA. We recommend locating your JIRA Home Directory completely independently of the JIRA Installation Directory (i.e. not nesting one within the other) as this will minimise information being lost during major operations (e.g. backing up and restoring instances). ## 3. Build JIRA Now build JIRA by typing build (Windows) or ./build.sh (Unix) on the command line in the$JIRA_INSTALL directory. This will produce the deployable WAR file in the $JIRA_INSTALL/dist-tomcat directory. ## 4. Update Tomcat Libraries Tomcat does not come with some libraries required to run JIRA. To fix this, download http://www.atlassian.com/software/jira/downloads/binary/jira-jars-tomcat-distribution-4.3-tomcat-5x.zip and copy the contained jars to Tomcat's common/lib/ directory. Be sure to remove existing versions of these JAR before copying the new ones. ## 5. Configure Tomcat A JIRA 'context' now needs to be set up in Tomcat. To do this: 1. Copy dist-tomcat/tomcat-5.5/jira.xml from the built JIRA distribution to your Tomcat's conf/Catalina/localhost/ directory. 2. Customise the copied jira.xml as follows: <Context path="/jira" docBase="path/to/atlassian-jira-4.1.war"> <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource" username="sa" password="" driverClassName="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:path/to/database/jiradb/" minEvictableIdleTimeMillis="4000" timeBetweenEvictionRunsMillis="5000"/> <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction" factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/> <Manager pathname=""/> </Context>  The paths (denoted as path/to/) will be correct by default, assuming you want to deploy the .war from the dist-tomcat/ directory. If you are not using hsqldb, make sure you comment out the minEvictableIdleTimeMillis and timeBetweenEvictionRunsMillis params, or JIRA will run slower than normal. If you are installing in Windows, make sure that the paths you specify for the location of the WAR file and database are full paths with drive letters (e.g. c:\yourdb\tomcatdb). N.B. the last part of the path is the name of the database and is not a directory.The above example assumes you are using hsql (an in-memory database — a good choice for evaluation purposes). Here is an example using MySQL: <Context path="/jira" docBase="path/to/atlassian-jira-3.13.war"> <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource" username="jirauser" password="mypassword" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/jiradb?useUnicode=true&amp;characterEncoding=UTF8" maxActive="20" validationQuery="select 1"/> <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction" factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/> <Manager pathname=""/> </Context>  Notice the lack of minEvictableIdleTimeMillis and timeBetweenEvictionRunsMillis parameters — those should only be used with hsql. 3. If using a different database than hsql, ## 6. Modify Tomcat server.xml In order for JIRA to correctly display internationalised characters in user and group names you need to modify your Tomcat distributions conf/server.xml file. You need to set the property URIEncoding="UTF-8" within the connector definition for your http protocol. The connector block should look very much like this: <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true"/>  You should modify the block to contain the addition of the URIEncoding property: <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>  Note Because you must define this property in at the connector level this setting will effect all web-applications you have deployed under the connector. This should not adversely effect the other web-applications but please be aware of this. JIRA will run fine without this property set but you will run into issues if a user or group is created which contains international characters. It is best to set this property to true. ## 7. Fix Tomcat memory settings This only works for Tomcat 5.5.15 and higher! Tomcat has a memory leak where large JSP page requests can fill up memory. To avoid this, edit Tomcat's bin/setenv.sh (create it if it does not exist) and set: export CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true"

or when installed as a Windows service, run:

tomcat5 //US//JIRA ++JvmOptions="-Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true

For other environments, and for more info on memory settings, see the memory settings page.

## 8. Set mail.mime.decodeparameters

The following system property must be set in order for the JIRA mail handler to work correctly with emails from RFC 2231-compliant mail clients:
mail.mime.decodeparameters=true

Refer to Setting Properties and Options on Startup for instructions.

## 9. Start Tomcat

JIRA should now be ready to run in Tomcat. To start using JIRA, first start (or restart) the Tomcat server with Tomcat's bin/startup.(sh|bat) scripts, and point your browser to http://localhost:8080/jira

You should now see the Setup Wizard, which will take you through the brief setup procedure.

## Troubleshooting

It is easy to make a mistake in this process, and even more so if you are trying to connect to a database other than hsqldb. First, check that you have followed the process described above:

• If you are using an external database (not hsqldb), have you set the field-type-name attribute in $JIRA_INSTALL/edit-webapp/WEB-INF/classes/entityengine.xml ? (step 2) • Have you previously started JIRA with an incorrect field-type-name value? If so, the database schema would have been created incorrectly. • If you have made changes to$JIRA_INSTALL/edit-webapp/WEB-INF/classes/entityengine.xml (step 2) and re-run the build script (step 3), but your changes are not being picked up, delete the Tomcat webapps/jira directory, then restart JIRA. It would seem that in some circumstances Tomcat does not correctly re-expand the web application.
• Have you copied the extra Tomcat jars (step 4)? Check if you have common/lib/objectweb-datasource-1.4.3.jar present.
• If using an external database, did you copy the JDBC driver jar to common/lib/ (step 5)?
• Is the path to the .war file in conf/Catalina/localhost/jira.xml correct?
• Have you copied the .war file to Tomcat's webapps/ directory? This is almost guaranteed to cause pain - please move it elsewhere, and delete any JIRA subdirectories created in webapps/ from previous Tomcat starts.
• Have you configured JIRA centrally in conf/server.xml instead of in conf/Catalina/localhost/jira.xml ? This is fine, but then be sure you don't also have a conf/Catalina/localhost/jira.xml present.
• The log files are usually vital to debugging problems. On Windows, these will appear in the console window that loads when running startup.bat , or in one of the log files in the logs/ directory. On Linux/Unix, logs will appear in a log file in logs/, usually logs/catalina.out. Check the log file for errors after startup.
• If you experience high memory usage / memory leaks (e.g. OutOfMemoryError), you may wish to set the system property -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true in setenv.sh / setenv.bat. This property is only valid for Tomcat 5.5.15 and later. For more information please see JRA-10145.
• If the connection to your MySQL database is dropping, you will need to set up Tomcat to survive connection closures.
• Please note: The build.xml file is an Ant file, which when invoked with the build.(sh|bat) script, will construct a deployable webapp. The build.xml file does this by copying the contents of the webapp/ directory, and overwriting it with the contents of edit-webapp/. Thus, never edit files in the webapp/ directory! If a file needs editing, first copy it from webapp/path/to/file to edit-webapp/path/to/file, and edit it there.

If you're stuck, please raise a support request, and attach your logs, configuration files, plus anything else relevant, and we'll get back to you as soon as possible.

## User-contributed notes

Have experiences to share with Tomcat 5.5.x and JIRA? We welcome your thoughts. Please see the user-contributed Tomcat 5.5.x notes.