This page last changed on Nov 02, 2008 by dyu.

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 for Confluence 2.8.x.

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 for a workaround if you intend to continue using the 64-bit JDK.

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

On this page:

Error formatting macro: toc: java.lang.NullPointerException

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 for a workaround if you intend to continue using the 64-bit JDK.



  • Starting the service produces an error similar to Failed creating java C:\jdk1.6.0_10\jre\bin\server\jvm.dll. This is because Tomcat is looking for a DLL 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

Document generated by Confluence on Dec 03, 2008 15:13