WSO2Con 2013 CFP Banner

How to Setup WSO2 WSAS 2.0 on Apache Tomcat

Discuss this article on Stack Overflow
By Chamara Silva
  • 17 Dec, 2008
  • Level:  Intermediate
  • Reads: 9264

WSO2 Web Services Application Server is an open source service-based application server fully built on Apache Axis2 framework. It supports various Web services standards and protocols.

chamara's picture
Chamara Silva
Associate Technical Lead
WSO2 Inc.

                        WSO2 Web Services Application Server  is capable of being deployed on most common application servers. These include application servers such as Apache Tomcat , IBM WebSphere , BEA WebLogic Server and JBoss. In this tutorial, I explain, how WSAS can be deployed on the Apache Tomcat application server. Following are the steps that need to be followed:

     Step1

                Download the Web Services Application Server and unzip the package.

     Step2

                Download Apache Tomcat and unzip the package

     Step 3

                Tomcat needs WSAS resource files running on it, in addition to the WSAS deployment package during run time. So you should assign the entire resource file in one environment variable. To do so,

    A. Copy “resources”, ”conf”,"database" and “repository” folders from WSAS unzipped package

    B. Create a new folder and name it as a “CarbonRepo”

    C. Paste the copied folder on to “CarbonRepo”

    D. Set the environment variable named “CARBON_HOME” to point to the folder named “CarbonRepo”

   Ex: your CarbonRepo folder in “D:\Projects\Carbon\WSAS\ CarbonRepo

    If you are using Linux,

        export  CARBON_HOME =/Projects/Carbon/WSAS/ CarbonRepo

    If you are using Windows,

        set CARBON_HOME = D:\Projects\Carbon\WSAS\ CarbonRepo                               

      Step 4

                Now, WSAS needs to be deployed in Apache Tomcat. To do so, follow the instructions below:

    A.      Copy  “WEB-INF”  in unzipped WSAS package/ webapps/ROOT

 Image1

 

    B.      Create a folder in Tomcat “webapps” folder and paste the WEB-INF folder there

image2 

     Step 5

                Now, you need to enable https in your Tomcat installation.(By default HTTPS protocol is disable in Apache Tomcat.)

                            A. Open server.xml in Apache Tomcat conf folder. Add the following script tag need to Apache Tomcat's server.xml file.

            <Connector

           port="8443" minSpareThreads="5" maxSpareThreads="75"

           enableLookups="true" disableUploadTimeout="true"

           acceptCount="100"  maxThreads="200"

           scheme="https" secure="true" SSLEnabled="true"

           keystoreFile="CARBON_HOME/resources/security/wso2carbon.jks" keystorePass="wso2carbon"

           clientAuth="false" sslProtocol="TLS"/>

          <!-- Define an AJP 1.3 Connector on port 8009 -->

          <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

         

                        B. You need to locate wso2carbon.jks keystore file in keystoreFile parameter, inside the Connector tag.

                    If your CARBON_HOME is in “D:\Projects\Carbon\WSAS\ CarbonRepo”, here is the complete path that needs to be added in the kerstoreFile parameter.

                    “D:/Projects/Carbon/WSAS/ CarbonRepo /resources/security/wso2carbon.jks”

                C. HTTPS 8443 port is now open for Apache Tomcat.

 

     Step 6

                Next, you should change WSAS “Server URL” in the carbon.xml file. You need to add the name of the folder you created in the Tomcat web apps folder as the server url. Following are the steps to change WSAS carbon.xml:

                             A. Open carbon.xml file in your CARBON_HOME/conf folder.

                        B. Change the HTTPS port number from 9443 to 8443. (Tomcat HTTPS enables in port 8443)

                           C. If the name of the folder in WSAS webapps is “WSAS”,

D.                        Your Final server url should be:


                    <ServerURL>https://localhost:8443/WSAS/services/</ServerURL>

      Step 7

                 You need to now do a small modification in Axis2.xml as well. In Tomcat, HTTP transport is enabled in port 8080, but for WSAS HTTP it is enabled in port 9763. Because of this you have to re-map the HTTP and HTTPS port umbers in WSAS Axis2.xml. Change the HTTP port number from 9763 to 8080 and HTTPS from 9443 to 8443. This should be as follows:

                       <transportReceiver name="http"

                       class="org.wso2.carbon.core.transports.http.HttpTransportListener">

                       <parameter name="port">8080</parameter>

                       </transportReceiver>

                      <transportReceiver name="https"

                       class="org.wso2.carbon.core.transports.http.HttpsTransportListener">

                      <parameter name="port">8443</parameter>

                      </transportReceiver>

             To enable WSAS tools, you need to make another change in the Axis2.xml file by adding “carbon” after the back slash in the context root parameter.

      Ex: -  <parameter name="contextRoot">/carbon</parameter>

 

      Step 8

                 Apache Tomcat configurations are all completed now. Start the Tomcat server. Here are the steps:

                         A. Go to Tomcat's bin folder on command prompt.

B.                           Start tomcat as,

                            Windows = apache-tomcat-6.0.14\bin>catalina.bat run

                            Linux = apache-tomcat-6.0.14\bin>catalina.sh run

      Step 9

                Upon starting up Apache Tomcat, use the following URL to access WSAS:

                https://localhost:8443/wsas/carbon

           

       Author: Chamara Silva is a Senior Software Engineer at WSO2. chamara at wso2 dot com

WSO2Con 2014 USA