Installing as a Windows Service

This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Installing as a Windows Service

WSO2 Carbon and any WSO2 product can be run as a Windows service. It is also possible to install and run multiple WSO2 products as Windows services simultaneously. See the following topics for instructions:

Read this if you are using WSO2 Enterprise Integrator

TipIf you are running multiple WSO2 Enterprise Integrator profiles as Windows services, a separate copy of the server pack should be used for each profile. This is done to avoid file locking and other concurrency related issues that may occur when more than one process is trying to access the same files.

 

Prerequisites

  • System requirements

  • Environment compatibility

  • Required applications
    The following applications are required for running the product and its samples or for building from the source code. Mandatory installations are marked with an asterisk *.

  • Download and install a service wrapper library to use for running your WSO2 product as a Windows service. WSO2 recommends Yet Another Java Service Wrapper (YAJSW), and several WSO2 products provide a default wrapper.conf file in their <PRODUCT_HOME>/bin/yajsw/ directory.

Installing a single product as a Windows service

Given below are the steps for installing a single WSO2 server as a windows service.

  1. Setting up the YAJSW wrapper: The configuration file used for wrapping Java Applications by YAJSW is wrapper.conf, which is located in the <YAJSW_HOME>/conf/ directory and in the <PRODUCT_HOME>/bin/yajsw/ directory of many WSO2 products. Following is the minimal wrapper.conf configuration for running a WSO2 product as a Windows service. Open your wrapper.conf file, set its properties as follows, and save it in the <YAJSW_HOME>/conf/ directory. 

  2. Setting up Carbon Home: Extract the Carbon-based product that you want to run as a Windows service, and then set the Windows environment variable CARBON_HOME to the extracted product directory location. For example, if you want to run ESB 4.5.0 as a Windows service, you would set CARBON_HOME to the extracted wso2esb-4.5.0 directory.

  3. Test the service in console mode: You can verify that YAJSW is configured correctly for running the Carbon-based product as a Windows service.

    1. Open a Windows command prompt and execute the runConsole.bat script from the <YAJSW_HOME>/bat/ directory as shown below.

      cd C:\DocumentsandSettings\yajsw_home\bat\runConsole.bat

      If the configurations are set properly for YAJSW, you will see console output similar to the following:

    2. You can now access the management console from your web browser via https://localhost:9443/carbon.

  4. Install and run the product as a service: Execute the relevant script as explained below.

    1. First, install the WSO2 product as a Windows service, by executing the following command in the <YAJSW_HOME>/bat/ directory:

      installService.bat

      The console will display a message confirming that the WSO2CARBON service was installed:

    2. Start the service by executing the following command in the same console window:

      startService.bat

      The console will display a message confirming that the WSO2CARBON service was started:

  5. Stop and uninstall service: Execute the relevant scripts as shown below.

    1. To stop the service, execute the following command in the same console window:

      stopService.bat

      The console will display a message confirming that the WSO2CARBON service has stopped:

    2. To uninstall the service, execute the following command in the same console window:

      uninstallService.bat

      The console will display a message confirming that the WSO2CARBON service was removed:

Installing multiple products as Windows services

The following instructions explain how to install multiple WSO2 servers in a single computer. In this scenario, you simple have to maintain separate YAJSW configuration files for each product. For example, consider that you need to install WSO2 ESB and WSO2 DSS as Windows services and follow the instructions given below.

  1. Download and unzip WSO2 ESB and WSO2 DSS.

  2. Download and unzip yajsw.

  3. Create two directories 'esb_service' and 'dss_service'.

  4. Copy the <YAJSW_HOME> directory to 'esb_service' and 'dss_service' separately. Now you will have two separate yajsw directories for the two products.

  5. Now, update the wrapper.conf file for each of the products, which is stored in the esb_service/<ESB_YAJSW_HOME>/conf/ and dss_service/<DSS_YAJSW_HOME>/conf/ directories. You simply have to replace carbon_home with esb_home and dss_home respectively.

  6. Copy the <ESB_HOME> directory to 'esb_service' and the <DSS_HOME> directory to 'dss_service'.

  7. Set port offset for DSS to '1' in the <DSS_HOME>/repository/conf/carbon.xml file. This will ensure that the DSS service will run on https port 9444 (default 9443 + 1). WSO2 ESB will be running on the default port 9443.

  8. Set the ESB_HOME, DSS_HOME and JAVA_HOME environment variables, which points to the extracted folders of each service.

  9. Now, update the wrapper.conf file for each of the products, which is stored in the esb_service/<ESB_YAJSW_HOME>/conf/ and dss_service/<DSS_YAJSW_HOME>/conf/ directories. You simply have to replace carbon_home with esb_home and dss_home respectively.

  10. Navigate to the esb_service/<ESB_YAJSW_HOME>/bin directory and execute the scripts as shown below.

    1. Run installService.bat to install the Windows service.

    2. Run startService.bat to start the service.

  11. Do the same above for the 'dss_service' as well.

  12. Right click on My Computer -> Manage. Then click Services and Applications -> Services. You can see both ESB and DSS services running. 

  13. You can now open the management consoles of the two products with the following urls:

    • For ESB: https://localhost:9443/carbon.

    • For DSS: https://localhost:9444/carbon.