This documentation relates to the latest version of Confluence.
If you are using an earlier version, please go to the documentation home page and select the relevant version.

Start Confluence automatically on Windows as a Service

All Versions
Click for all versions
Confluence 2.9 Documentation

Index

For long-term use, we recommend that you configure Confluence to start automatically when the operating system restarts. For Windows servers, this means configuring Confluence to run as a Windows service.

Note for 64-bit Windows

If you are running 64-bit Windows, please note that Apache Tomcat cannot run as a Windows service if you are using a 64-bit JDK. Please ensure that you are using a 32-bit JDK. (If you used the automated Confluence Installer, you will not run into this problem because a 32-bit JDK has already been installed for you.) For more information, please refer to CONF-12293.

There are two ways to install Confluence as a service: via the Confluence installer or manually as described below.

On this page:

Reasons for Starting Confluence as a Service

Installation as a Windows service offers these advantages:

  • Reduced risk of shutting down Confluence by accident. (If you start Confluence manually, a console window opens and there is a risk of someone accidentally shutting down Confluence by closing the window.)
  • Automated Confluence recovery after server restart
  • Improved troubleshooting through logging server output to file

You can read more about Windows services in the Microsoft Developer Network.

Using the Installer to Install Confluence as a Service

If you use the automated Confluence Installer to install Confluence on Windows, you will be prompted to choose to install Confluence as a Windows service. For more information about the automated Confluence Installer, please refer to Installing Confluence Standalone.

Manually Installing Confluence Standalone as a Service

From your Windows-based server:

  1. Open a command prompt in the <CONFLUENCE-INSTALL>/bin directory.

  2. Confirm that the JAVA_HOME variable is set to the JDK base directory with the command:
    echo %JAVA_HOME%

    Note that any directory in the path with spaces (eg. C:\Program Files must be converted to its eight-character equivalent (e.g. C:\Progra~1).

  3. If you are installing Confluence on a Windows 2008 server, be sure to run the command prompt using 'run as administrator'. (Otherwise running 'service.bat', as described in the next step, will fail.)

  4. Use the following command to install the service with default settings:
    service.bat install Confluence
  5. Now, to have the service start automatically when the server starts, run:
    tomcat5 //US//Confluence --Startup auto
    
  6. If you have a less than a 512 megabytes of memory, skip this step. For users with large Confluence installations, you can increase the maximum memory Confluence can use. (The default is 256MB). For example, you can set the maximum memory to 512 megs using:
    tomcat5 //US//Confluence --JvmMx 512
    
  7. If you do not have any JVM parameters you pass to your standalone version of Confluence, you can skip this step. If you do, add them to the service using:
    tomcat5 //US//Confluence ++JvmOptions="-Djust.an.example=True"
    
  8. For further configuration options, please refer to the Tomcat Windows Service How-To guide

  9. Go to your Windows Control Panel -> Administrative Tools -> Services -> Apache Tomcat Confluence and right-click on Properties to verify the settings are correct.

  10. If you wish to run the service as a non-administrator user for security, or if you are using network drives for backups, attachments or indexes, you can run the service as another user. To change users, open the Apache Tomcat Confluence properties, go to the 'Log On' tab and enter the required username and password. Go to your Windows Control Panel -> User Accounts and confirm that the user has write permissions for the %CATALINA_HOME%, index and database directories. Note that any network drives must be specified by UNC and not letter mappings (eg. \\backupserver\confluence not z:\confluence)

    Confluence is now be installed as a service, but will not automatically start up until the next server reboot

  11. Start the Confluence service with the command:
    net start Confluence

Managing Confluence as a Service


You can manage the Confluence service from the command prompt.

  • Stop Confluence with:
    net stop Confluence
  • Uninstall the Confluence service with:
    service.bat remove Confluence

Troubleshooting Confluence while Running as a Service

  • When investigating memory issues or bugs, it may be useful to view information from Confluence's garbage collection. To turn on the verbose garbage collection, use the command:
    tomcat5 //US//Confluence ++JvmOptions="-Xloggc:<CONFLUENCE-INSTALL>\logs\atlassian-gc.log"
    



  • If you are running 64-bit Windows, please note that Apache Tomcat cannot run as a Windows service if you are using a 64-bit JDK. Please ensure that you are using a 32-bit JDK. (If you used the automated Confluence Installer, you will not run into this problem because a 32-bit JDK has already been installed for you.) For more information, please refer to CONF-12293.



  • Unable to configure Confluence to run as a service because Tomcat can't find msvcr71.dll. Please refer to this Knowledge Base article.

  • Unable to start Confluence as service after Allocating higher JVM Memory. Please refer to this Knowledge Base article.

  • Confluence 2.9 Installer does not work when installed as service, due to missing semi-colon in service.bat. Please refer to reported issue CONF-12785.

Upgrading Confluence

After upgrading Confluence, you can either uninstall and reinstall the Windows service or change the StartPath parameter to your new folder. Refer to the Tomcat documentation for help.

RELATED TOPICS

Start Confluence automatically on system startup
Fix Out of Memory errors by Increasing Available Memory

Labels:

appserver appserver Delete
confluence22 confluence22 Delete
memory memory Delete
auto-startup auto-startup Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Feb 21, 2008

    Jeff Branc says:

    regarding Step 8 - verify command line. I followed all the instructions, includ...

    regarding Step 8 - verify command line. I followed all the instructions, including running the 3 tomcat5 commands to set prefs, but my service command line looks like this:

    C:\confluence\confluence-2.7.1-std\bin\tomcat5.exe //RS//Confluence

    in Step 8 can you provide a hint at what the command should look like when using the examples provided?

    -

    Couple more points

    1) if you want to know or edit the parameters, you can copy tomcat5.exe to Confluencew.exe (copy, don't rename).  then run Confluencew.exe - it will show a control panel with all the info.

    2) you can't run this as a service with Java x64.  see http://www.jguru.com/forums/view.jsp?EID=1298519 for more info. 

    1. Feb 24, 2008

      Choy Li Tham says:

      Hi Jeff, If C:\confluence\confluence-2.7.1-std\bin\tomcat5.exe //RS//Confluence...

      Hi Jeff,

      If C:\confluence\confluence-2.7.1-std\bin\tomcat5.exe //RS//Confluence is the properties that you see through STEP 8, I believe you have run the following command (in Step 3) via the Command prompt in <CONFLUENCE-INSTALL>/bin directory :

      service.bat install Confluence
      

      The RS argument will be appended to the Path to executable which runs the Confluence as service. For more information regarding Window Service, please refer to the documentation here.

      Regards,
      Choy Li

  2. Apr 13

    Bob Swift says:

    This information is not valid for 2.8.

    This information is not valid for 2.8.

    1. Apr 20

      Mei Yan Chan says:

      Hi Bob, The installer for Confluence 2.8 allows the initial configuration to ru...

      Hi Bob,

      The installer for Confluence 2.8 allows the initial configuration to run Confluence as a service as shown at:

      Is that why you indicated that this current doc is not valid for v.2.8?

      Regards,
      Mei

      1. May 12

        Tom Lucas says:

        Perhaps Bob is indicating that about above instructions do not work for Confluen...

        Perhaps Bob is indicating that about above instructions do not work for Confluence 2.8.

        We just migrated from a Linux Confluence 2.7 installation to a Windows 2.8 installation. Everything works great except for the service correctly starting.

        When you start the service from the command line: net start Confluence, it says that it starts successfully. Unfortunately doing a netstat -a does not show port 8080 or 8443, depending on how you set things up, as a listening port.

        The Tomcat5.exe executable is running but the listener appears to not be started.

        When I run startup.bat from the command line, everything is fine. It is only trying to run this as a service that has a problem.

        Server is Windows 2003 Server with SP 2 on it.

      2. May 12

        Tom Lucas says:

        One other note. Running the command line from the command prompt does not yield...

        One other note.

        Running the command line from the command prompt does not yield any errors, nor does the listener start.

        C:\confluence\confluence-2.8.0-std\bin\tomcat5.exe //RS//Confluence 

        Running the command line in the console mode from the command prompt works fine.

        C:\confluence\confluence-2.8.0-std\bin\tomcat5.exe //TS//Confluence 

        Perhaps this is something to do with interactive session?

        1. May 13

          Tom Lucas says:

          Call me foolish but I found the issue. We are running Confluence under SSL on po...

          Call me foolish but I found the issue. We are running Confluence under SSL on port 8443. We generated the cert and keystore while logged in as administrator. This places the .keystore file in the Administrator profile. The Windows service looks for the .keystore in the Default User profile. Copied the .keystore file to the Default User profile and everything is working well now.

          Thanks 

          1. May 22

            Anonymous says:

            Tom, Where is that .keystore located in the administrator's profile when it was...

            Tom,

            Where is that .keystore located in the administrator's profile when it was initially installed?

  3. Aug 29

    Anonymous says:

    I get "The CATALINA_HOME environmental variable is not defined correctly" even t...

    I get "The CATALINA_HOME environmental variable is not defined correctly" even though I have defined it to point to my confluence bin directory.

    1. Sep 03

      Tony Cheah Tong Nyee says:

      Hi there, I would suggest you to raise a support issue regarding this at: ht...

      Hi there,

      I would suggest you to raise a support issue regarding this at:

      From there, we would be able to help you further.

      Cheers,
      Tony

  4. Aug 31

    Martin Cleaver says:

    I believe there is a bug in Confluence 2.9's service.bat file In Confluence 2.7...

    I believe there is a bug in Confluence 2.9's service.bat file

    In Confluence 2.7 line 113 was:

    "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" --JvmMs 128 --JvmMx 256

    In Confluence 2.9 line 113 became:

    "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp -XX:MaxPermSize=128m" --JvmMs 128 --JvmMx 256

    This gave me error:

    Aug 31, 2008 5:23:28 PM org.apache.catalina.startup.Embedded initDirs
    SEVERE: Cannot find specified temporary folder at D:\ConfluenceApplication\confluence-2.9-std\temp -XX:MaxPermSize=128m

    Changing the line to:

    "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" -XX:MaxPermSize=128m --JvmMs 128 --JvmMx 256

    Fixed the issue for me.

    Thanks,

       Martin.

    1. Sep 06

      Brett Shelton says:

      Martin, This fixed the issue for me as well, but I used the following as line 1...

      Martin,

      This fixed the issue for me as well, but I used the following as line 113:

      "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" -XX:MaxPermSize=128m --JvmMs 128 --JvmMx 256 --Jvm "%JAVA_HOME%\bin\client\jvm.dll"

  5. Sep 01

    David says:

    After following these instructions the service was installed and appeared to be ...

    After following these instructions the service was installed and appeared to be configured correctly. The problem was that the service did not start automatically when Windows started and when I went to Windows Services and tried to manually start the service it returned the error Windows could not start the Apache Tomcat Confluence on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 0. In Event Viewer there was the error The Apache Tomcat Confluence service terminated with service-specific error 0 (0x0).

    In the catalina.*.log files, amongst other messages, there was the following which relates directly to the service being started:

    [2008-09-02 07:46:55] [info] Running Service...
    [2008-09-02 07:46:55] [info] Starting service...
    [2008-09-02 07:46:56] [174  javajni.c] [error] The specified module could not be found.
    [2008-09-02 07:46:56] [947  prunsrv.c] [error] Failed creating java C:\Program Files\Java\jdk1.6.0_07\jre\bin\server\jvm.dll
    [2008-09-02 07:46:56] [1202 prunsrv.c] [error] ServiceStart returned 1
    [2008-09-02 07:46:56] [info] Run service finished.
    [2008-09-02 07:46:56] [info] Procrun finished.

    The fix was to download a copy of msvcr71.dll and place it the WINDOWS/system32 directory. It appears that Tomcat 5 expects that this DLL to be present and when it is not it fails to automatically start. I am not sure under what circumstances this file does or does not exist but we are running a freshly installed copy of Windows Server 2003 R2 Standard.

    1. Sep 18

      Anonymous says:

      Thanks David! I had set up Confluence and had it running, then a power outag...

      Thanks David! I had set up Confluence and had it running, then a power outage caused a reboot and the service wouldn't start either automatically or manually, returning the same error message you quoted above. I'm also on 2k3 R2 Standard. I found several instances of msvcr71.dll on my system and copied one to system32, which seems to have fixed the problem.

  6. about 17 hours ago

    Anonymous says:

    Ihave a problem  with local host, "http://localhost:8080/", is it correct, ...

    Ihave a problem  with local host, "http://localhost:8080/", is it correct, cause every time I type down the url, I gt a warning message telling me it is impossible to acces, can't find server. what should I do?

    1. about 10 hours ago

      Azwandi Mohd Aris says:

      Hi there, I would suggest you to raise a support request at http://support.atla...

      Hi there,

      I would suggest you to raise a support request at http://support.atlassian.com, and attach a copy of <confluence-install>/logs directory, atlassian-confluence.log and <confluence-install>/conf/server.xml. Thanks.

      Cheers,
      Azwandi

Add Comment