Execute JOnAS as a Windows Service

1.1. Instructions
1.1.1. Download and Install Apache ANT
1.1.2. Download and Install Java Service Wrapper
1.1.3. Create the JOnAS Windows service
1.1.4. Personalise JOnAS options
1.1.5. Test the JOnAS Windows service
1.1.6. Install the JOnAS Windows service
1.1.7. Start the JOnAS Windows service
1.1.8. Stop the JOnAS Windows service
1.1.9. Restart the JOnAS Windows service
1.1.10. Uninstall the JOnAS Windows service

This document describes the procedures necessary to run JOnAS as a system service on Microsoft Windows platforms.

1.1. Instructions

The procedure uses the Tanuki Java Service Wrapper open source project which must be downloaded and installed separately.

1.1.1. Download and Install Apache ANT

  1. Download Apache ANT version 1.7.1 or later.

  2. Unzip the package to a directory in the local filesystem.

  3. Set ANT_HOME environment variable to the root directory for Apache ANT.

    For example, if the package for ANT version 1.7.1 is unzipped into C:\Program Files , then set ANT_HOME = C:\Program Files\apache-ant-1.7.1

  4. Add %ANT_HOME%\bin to your PATH environment variable.

1.1.2. Download and Install Java Service Wrapper

  1. Download Tanuki Java Service Wrapper version 3.3.9 or later (the "Community Edition" is sufficient for executing JOnAS as a Windows Service).

  2. Unzip the package to a directory in the local filesystem.

  3. Set WRAPPER_HOME environment variable to the root directory for Java Service Wrapper.

    For example, if the package for Wrapper version 3.3.9 is unzipped into C:\Program Files , then set WRAPPER_HOME = C:\Program Files\wrapper-windows-x86-32-3.3.9

1.1.3. Create the JOnAS Windows service

Before JOnAS can be run as a Windows service, it is necessary to create a Java Service Wrapper configuration file. Prior to executing the steps in this section, it is necessary to create a JONAS_BASE directory as described in the JOnAS Configuration Guide .

  1. Verify that JAVA_HOME is set as a system environment variable.

  2. Verify that JONAS_ROOT, JONAS_BASE and WRAPPER_HOME environment variables are set.

  3. Set %JONAS_ROOT%\templates\windows_service as the current directory.

  4. Set environment variables required for JOnAS execution (see list below).

  5. Execute ant [-Djonas.name=<server_name>]

    [Note] Note

    The -Djonas.name=<server_name> parameter is optional. If not specified, the default server name is 'jonas'.

Once this is done, the wrapper.conf file inside your JONAS_BASE will be filled with all launch options required by JOnAS.

[Note] Note

Do not change the wrapper.conf file as it will be regenared everytime you run the Apache ANT task. To put your own, personalized options, use the wrapper_extra.conf file in JONAS_BASE instead.

1.1.4. Personalise JOnAS options

To add options to your JOnAS server running as a Windows service, modify the wrapper_extra.conf file in JONAS_BASE.

[Note] Note

Once this file is changed, you'll need to restart the JOnAS service to see the effects. You do not need to reinstall the service, thought.

1.1.5. Test the JOnAS Windows service

After the %JONAS_BASE% directory has been updated for use with Java Service Wrapper, the Windows service configuration can be tested by executing the command:


          jonas ntservice console
        

Once you see that JOnAS is running, simply press CTRL + C to stop it.

1.1.6. Install the JOnAS Windows service

Once you're assured the Windows service is operational, install in onto Windows using the following command:


          jonas ntservice install
        

1.1.7. Start the JOnAS Windows service

To start the JOnAS Windows service, you can use the Windows Services control panel item or launch the following command:


          jonas ntservice start
        

[Note] Note

By default, JOnAS will be started automatically each time Windows is started. After installing the service, it can be started manually to avoid the need to reboot Windows.

1.1.8. Stop the JOnAS Windows service

To stop the JOnAS Windows service, you can use the Windows Services control panel item or launch the following command:


          jonas ntservice stop
        

1.1.9. Restart the JOnAS Windows service

To restart the JOnAS Windows service, you can use the Windows Services control panel item or launch the following command:


          jonas ntservice restart
        

1.1.10. Uninstall the JOnAS Windows service

To uninstall the JOnAS Windows service, use the following command:


          jonas ntservice uninstall
        

[Note] Note

Do not re-create the JOnAS Windows service before uninstalling it; else JOnAS might lose the reference to the Windows service entry and therefore never manage to uninstall the service.