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:
Prerequisites
- Install JDK 1.6.24 or later or 1.7.* and set up the
JAVA_HOME
environment variable. - 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.
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 minimalwrapper.conf
configuration for running a WSO2 product as a Windows service. Open yourwrapper.conf
file, set its properties as follows, and save it in the<YAJSW_HOME>/conf/
directory.If you want to set additional properties from an external registry at runtime, store sensitive information like usernames and passwords for connecting to the registry in a properties file and secure it with secure vault.
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 setCARBON_HOME
to the extractedwso2esb-4.5.0
directory.- Test the service in console mode: You can verify that YAJSW is configured correctly for running the Carbon-based product as a Windows service.
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:
You can now access the management console from your web browser via https://localhost:9443/carbon.
- Install and run the product as a service: Execute the relevant script as explained below.
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:
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:
- Stop and uninstall service: Execute the relevant scripts as shown below.
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:
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.
- Download and unzip WSO2 ESB and WSO2 DSS.
- Download and unzip yajsw.
- Create two directories 'esb_service' and 'dss_service'.
- Copy the
<YAJSW_HOME>
directory to 'esb_service' and 'dss_service' separately. Now you will have two separate yajsw directories for the two products. Now, update the
wrapper.conf
file for each of the products, which is stored in theesb_service/<ESB_YAJSW_HOME>/conf/
anddss
_service/<DSS_YAJSW_HOME>/conf/
directories. You simply have to replacecarbon_home
withesb_home
anddss_home
respectively.- Copy the
<ESB_HOME>
directory to 'esb_service' and the<DSS_HOME>
directory to 'dss_service'. - 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. - Set the ESB_HOME, DSS_HOME and JAVA_HOME environment variables, which points to the extracted folders of each service.
Now, update the
wrapper.conf
file for each of the products, which is stored in theesb_service/<ESB_YAJSW_HOME>/conf/
anddss
_service/<DSS_YAJSW_HOME>/conf/
directories. You simply have to replacecarbon_home
withesb_home
anddss_home
respectively.- Navigate to the
esb_service/<ESB_YAJSW_HOME>/bin
directory and execute the scripts as shown below.- Run
installService.bat
to install the Windows service. - Run
startService.bat
to start the service.
- Run
- Do the same above for the 'dss_service' as well.
Right click on My Computer -> Manage. Then click Services and Applications -> Services. You can see both ESB and DSS services running.
You can stop or restart the services from the UI as shown in the diagram above.
Alternatively, you can go to the/<YAJSW_HOME>/bin
directory for each product and execute thestopService.bat
anduninstallService.bat
scripts to stop and uninstall Windows services.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.