Start Confluence Automatically on Windows as a Service

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

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.

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

On this page:

Problem with 64-bit Windows

If you are running 64-bit Windows, please note that you may encounter problems with Apache Tomcat running as a Windows service if you are using a 64-bit JDK. Refer to our knowledge base article for more information.

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.

Changing the user running the service

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 <CONFLUENCE-INSTALL> and <CONFLUENCE-HOME> directories and all subfolders. Note that any network drives must be specified by UNC and not letter mappings (eg. \\backupserver\confluence not z:\confluence).

For more detail, see Creating a Dedicated User Account on the Operating System to Run Confluence.

Manually installing Confluence as a service

In Windows:

  1. Open a command prompt and change directory to the <CONFLUENCE-INSTALL>/bin directory.
    You'll need to run the command prompt using 'Run as administrator' so that you can complete some of these steps.  
  2. Confirm that the JAVA_HOME variable is set to the JDK base directory with the command:

    echo %JAVA_HOME%
    

    If you installed the Java Runtime Environment (JRE) or used the Confluence installer, replace JAVA_HOME with JRE_HOME. See Setting the JAVA_HOME Variable in Windows for more info. 

    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. Use the following command to install the service with default settings:

    service.bat install Confluence
    

    The service will be called Atlassian Confluence and will be configured to start automatically by default, but will not automatically start up until the next server reboot.

  4. If you have a large Confluence installation, you can increase the maximum memory Confluence can use (the default is 1024MB). For example, you can set the maximum memory to 2048MB using:

    tomcat9w //US//Confluence --JvmMx 2048
    
  5. If you don't have any JVM parameters that you pass to Confluence, you can skip this step. If you do, add them to the service using:

    tomcat9w //US//Confluence ++JvmOptions="-Djust.an.example=True"
    

    Alternatively you can use the following command to launch the service properties dialog then navigate to the Java tab to add more JVM parameters. 

    tomcat9w //ES//Confluence


    For further configuration options, please refer to the Tomcat Windows Service How-To guide.

  6. Go to Control Panel > Administrative Tools > Services > Atlassian Confluence and right-click Properties to verify the settings are correct.  Start the Confluence service with the command:
  7. Finally, start the Confluence service. From now on this will happen automatically after the a server reboot. 

    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
    

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.

Troubleshooting Confluence while running as a Windows service

  • If none of the above solves your problem, please refer to the complete list of known issues in our Knowledge Base.
  • You can use a Sysinternals tool called Procmon.exe from the The Microsoft Windows Sysinternals Team, to check that the error occurred at the specific time when the Confluence service started. You need to match the time when Tomcat failed, as captured by this tool, against the time in the Windows Event Viewer.

    Note

    We do not recommend that you run this tool for too long as it may disrupt other Atlassian applications. Once you have captured the required information you will need to press Ctrl + E to stop capturing.

Requesting Support

If, after following the troubleshooting guide above, you still cannot make Confluence run as a Windows Service or if there is an error when setting the JVM configuration for the service, you can create a support request.

Please provide the following information when creating your support request, because we will need it to assist you:

  • Give us the result of running java -version from Windows command line console.
  • A screen shot of your Windows Registry setting for Tomcat.
  • If you have modified service.bat, please give us a copy of this file for review.
  • A support zip, containing your application logs and configuration files.
Last modified on Mar 22, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.