# Running JIRA as a Service

For long-term use, JIRA should be configured to automatically restart when the operating system restarts. For Windows servers, this means configuring JIRA to run as a Windows service.

If you are running JIRA on Linux and want to start it automatically, please refer to Starting JIRA Automatically on Linux instead.

Running JIRA as a Windows service has other advantages. When started manually a console window opens and there is a risk of someone accidentally shutting down JIRA by closing this window. Also, the JIRA logs are properly managed by the Windows service (found in logs\stdout*.log in your JIRA Home Directory, and rotated daily).

There are two ways to install JIRA as a service: via the installer, and manually.

## Installing as a Service with the Installer

The easiest way to get JIRA installed as a Windows service is by clicking the 'Install JIRA as Service' check box when running the Windows Installer:

You will need full Administrator rights on your Windows operating system for this installation process to complete successfully.

### Manually Setting up JIRA to Run as a Service

You can still set up JIRA to run as a service, if any of the following situations apply to you:

• You did not use the Windows Installer.
• You used the Windows Installer, but did not initially install JIRA as a service.

• These instructions do not apply to installations of the JIRA WAR distribution. To run a JIRA WAR installation as a service, refer to the relevant JIRA WAR installation instructions for Apache Tomcat 6.0 or 7.0.
• On any Windows operating system with User Account Control (UAC) such as Windows Vista or Windows 7, you must either disable UAC or run 'cmd.exe' as an administrator (e.g. by right-clicking on 'cmd.exe' and selecting "Run as administrator") in order to execute the script in the procedure below. If UAC is enabled, simply logging in to Windows with an Administrator account will not be sufficient.

To set up JIRA to run as a service:

1. Open a Command Prompt.
2. Change directory ('cd') to the JIRA installation directory and then into this directory's 'bin' subdirectory.
If a directory in the path has spaces (e.g. 'C:\Program Files\..'), please convert it to its eight-character equivalent (e.g. 'C:\Progra~1\..').
3. Ensure the JAVA_HOME variable is set to the root of your Java platform's installation directory.
To find out the current value of the JAVA_HOME variable, enter echo %JAVA_HOME% at the command prompt.
4. Run the following command:

Here is a screenshot of the process:

JIRA should now be set up to run as a service.

5. In addition, to have the JIRA service start automatically when the operating system starts, run:

The JIRA service will automatically start up the next time the operating system reboots. The JIRA service can be manually started with the command 'net start JIRA' and stopped with 'net stop JIRA'.

To see what parameters the JIRA service is starting with, go to Start -> Run and run 'regedt32.exe' and then:
* For Windows 32 bit edition navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> Apache Software Foundation -> Procrun 2.0 -> JIRA<time stamp>
* For Windows 64 bit edition navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> Wow6432Node -> Apache Software Foundation -> Procrun 2.0 -> JIRA<time stamp>

6. Additional JIRA setup options (optional):

For JIRA 5.2 and above run these tomcat7 commands, but for JIRA 5.1 or below run the tomcat6 command instead

• To increase the maximum memory JIRA can use (the default will already be 256MB), run:

where service_name is the name of your JIRA service, e.g. JIRA123487934298.

• To add a JVM parameter, for example pass a parameter to enable JIRA's Jelly support, run:

where service_name is the name of your JIRA service, e.g. JIRA123487934298.

• If you are running JIRA and Confluence in the same JVM, increase the MaxPermSize size to 128 MB:

where service_name is the name of your JIRA service, e.g. JIRA123487934298.

• Occasionally, it may be useful to view JIRA's Garbage Collection information. This is especially true when investigating memory issues.To turn on the Verbose GC (garbage collection) logging, execute the following command in the command prompt:

where service_name is the name of your JIRA service, e.g. JIRA123487934298.
The path (denoted by \path\to) refers to the directory in which JIRA is currently installed. For example:

where service_name is the name of your JIRA service, e.g. JIRA123487934298.

See the Tomcat documentation for further service options.

## Removing the JIRA service

If JIRA was installed through the Windows installer, go to the 'Control Panel' in Windows, click 'Add or Remove Programs' and remove JIRA. This will remove the service too.

If you installed the service manually (see above) it can be uninstalled with:

Alternatively, if the above does not work, use tomcat7 //DS//JIRA.

## Changing the Windows user that the JIRA service uses

If you are using mapped network drives for JIRA's backup directory, attachments directory, index directory or the %CATALINA_HOME%\‌* directory, you need to ensure that JIRA can write to these drives. That is, these directories all need to be writeable by the user which the JIRA service is running as. This may mean that you need to change the Windows user that the JIRA server uses.

Note that you must also specify these network drives by UNC and not letter mappings, e.g. \\backupserver\jira not z:\jira

To change the Windows user that the JIRA service uses, navigate to the service in Windows, i.e. 'Control Panel' -> 'Administrative Tools' -> 'Services'. Locate the 'Atlassian JIRA' service, right-click and view the 'Preferences'.

Go to the 'Log On' tab and change the user as desired.

## Specifying the startup order of multiple services

If you have services that depend on each other, it is important that they are started in the correct order. Common examples include:

• If you are running both JIRA and Crowd, it is important to start Crowd first, so that Crowd is running before people try to login to JIRA.
• If the database JIRA connects to is hosted on the same server as JIRA, and is started via a Windows service, the JIRA service will only start successfully if the database service has already started first.

To set up start up dependency rules, open a command prompt and enter the following command:
C:\Documents and Settings\Developer>sc config [JIRA service] depend=[database service]
Please note the space character after 'depend='.

• [JIRA service] is the name of the JIRA service you are running, e.g. JIRA051007111904.
• [database service] is the name of the database service you are running, e.g. MSSQLSERVER.

If you wish, you can also set up dependency rules by editing the system registry. Please see http://support.microsoft.com/kb/193888 for details on how to do this.

Note, when you shut down Windows, make sure that the JIRA service shuts down before the database service. You could use a batch script for this.

## Locating the name of a service

If you do not know the exact name of your JIRA service or your database service, you can find out what they are by following the steps below:

1. Navigate to 'Control Panel' > 'Administrative Tools' > 'Services'.
2. The 'Services' window should appear:
3. Right-click on the service you wish to find out the name of, and select 'Properties' from the popup menu:
4. The 'Service name' should appear in the 'General' tab:

## Troubleshooting

• Java 6 is not supported by JIRA 6.0 and later. Problems may occur when trying to setup JIRA to run as a Windows service with JDK 1.6. The problem is due to failure to locate "MSVCR71.DLL", which can be found in %JAVA_HOME%/bin. There are two options to resolve this problem:
• Add %JAVA_HOME/bin to PATH, then restart the JIRA server.
• Copy MSVCR71.DLL to system path, C:\WINDOWS\SYSTEM32 or C:\WINNT\SYSTEM32
• Take note of the username that the service is running as, and be sure to modify the /temp and /work directories in your install directory so that this user has read and write permissions.
• You cannot run JIRA as a service on a 64-bit operating system if you require allocating more than 1.5GB of memory, due to 32-bit JDK memory limitations and 64-bit JDK/Tomcat service issues.

1. Ronald de Vries

Can you please also back link the "Run as Administrator" comment in the 3.13 documentation. It is entirely possible that someone might run that version on a Windows 7 platform and it's missing there as a comment. Since you've closed comments on that version of the documentation I could not add this myself.

02 Jun 2010
2. Anonymous

I am trying to remove JIRA from my Windows XP system, but none of the above suggestions works.

I had to find out the real service name, which was JIRA040111134406 in order to remove the jira service.

14 Feb 2011
3. Ivar Sønstabø

On a Windows 2008 R2 64 bits server, the registry 'url' is:

HKEY_LOCAL_MACHINE>SOFTWARE>Wow6432Node>Apache Software Foundation>Procrun 2.0>Jira>Parameters.

24 Feb 2011
1. Bogdan Dziedzic

Hi Ivar,

Based on the provided feedback we have improved our documentation to distinguish between 32 and 64 bit OS

Cheers,

20 May 2011
4. Valentijn Scholten

Re:

C:\Documents and Settings\Developer>sc config [JIRA service] depend=[database service]

Please note the space character after 'depend='.

-->There's no space in the command line.

The command also removes any pre-existing dependencies.

21 May 2011
5. Anonymous

If you're using an external database it is vital you add it as a dependency of the service, otherwise you might run into the following error under MySQL:

"The last packet sent successfullytothe server was0milliseconds ago.the driver hasnotreceivedanypacketsfromthe server."

I assume this is because JIRA tried to connect to the database before it was initialized. I fixed the problem by running "sc config [JIRA service] depend= Tcpip afd mysql"

08 Aug 2011
6. Anonymous

I'm trying to set up a Windows Service for JIRA on a WIndows XP machine.  Using the service.bat file the service installs and seems to be running fine.  However, when trying to access the URL JIRA will not load.  Jira will run fine when starting the "startup.bat" file.   Any ideas?

17 Jan 2012
7. Anonymous

I experienced some problems running as a service on 64 bit Windows. Turns out that you need to replace the tomcat6.exe with the tomcat6.exe.x64 - just if you happen to overlook the two different tomcat6 files as I did.

07 May 2012
8. Anonymous

If you change the user of the JIRA service, does it really only need read/write to the /temp and /work folder? what about the /logs folder, or the home folder?

In my opinion these instructions should be under the instructions for changing the username a service runs as, not in the troubleshooting.

19 Jul 2012
9. Dave Thomas

I believe the reference to JRA-12965 is outdated and should be removed.   Also, doesn't tomcat6.exe.x64 need to be renamed if you're trying to run as a 64-bit service?  I see no mention of this anywhere in the installation instructions.

26 Sep 2012
1. Nancy Belser

I renamed tomcat.exe as you mentioned, but I did not have success starting the service in 64 bit windows using 64 bit JVM.  I still had to use the amd64 version of tomcat.exe and tomcat6.exe as referred to in the comments of JRA-12965; the reference to that case is not outdated.

18 Oct 2012
10. Anonymous

## Starting Jelly on a Windows XP 64 bit machine

Ignore the documentation above. This works:

To see what parameters the JIRA service is starting with, go to Start -> Run and run 'regedt32.exe' and then:

For Windows 64 bit edition navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> Wow6432Node -> Apache Software Foundation -> Procrun 2.0 -> JIRA -> <JIRA Service Name> -> Parameters -> Java

Edit the Options by double clicking on it and add:

-Djira.jelly.on=true

27 Sep 2012
11. Anonymous

For people using JIRA 5.2+, shouldn't this be changed to use Tomcat7?

03 Dec 2012
12. Chantele Parker

To change your windows service options (for JIRA 5.2.1)

Popup window will appear.

You can change the JVM path on the Java tab.

03 Dec 2012
13. Anonymous

Should put a requirement in on JDK for the JIRA install since service.bat fails if you have the JRE installed.

27 May 2013
14. Christoph De Baene

I installed JIRA 6.0.4 (Zip Archive) on a Windows Server 2008 R2 Standard.
Output of echo %JAVA_HOME% is C:\Program Files\Java\jdk1.7.0.25

I can launch Jira from the console (start-jira.bat) but when I try to start as a service (net start jira) I get the following error

[2013-07-16 10:18:12] [info] Commons Daemon procrun (1.0.10.0 32-bit) started[2013-07-16 10:18:12] [info] Running 'Jira' Service...[2013-07-16 10:18:12] [info] Starting service...[2013-07-16 10:18:12] [error] Failed creating java [2013-07-16 10:18:12] [error] ServiceStart returned 1[2013-07-16 10:18:12] [info] Run service finished.[2013-07-16 10:18:12] [info] Commons Daemon procrun finished

Any Ideas?

16 Jul 2013
1. Karlheinz Dreßen

I get the same problem with JIRA 6.1.7 and jdk 1.7.0.45.

Starting with start-jira.bat works.

Starting with "net start JIRA" under "windows server 2008 R2" produces the error. Exact the same seven lines as for Christoph.

• setting rights for directories
• moving dll

and so on. Nothing works.

21 May 2014
15. Cas Alvaro

Hello friends,
I have a problem starting the trial version of JIRA, do the following steps:
- 1st Start the "Start JIRA Server [8080]
- 2nd Access JIRA (browser screen - localhost 8080)

The browser screen has loaded the configuration screen, but it was a long time setting, has become to start but it does not load the configuration screen.

The command line screen shows some messages like:
"JIRA 6.1 build: 6144 started,. You can now access JIRA trought your browser."
"JIRA startup failed, JIRA has been locked."

Does anyone have idea how I can solve it?

15 Oct 2013