2009/07/23
23 Jul, 2009

Setup WSAS 3.1 on Apache Tomcat

  • Chamara Silva
  • Technical Lead - WSO2

1. Download the Web Services Application Server and unzip the package.

2. Download Apache Tomcat and unzip the package

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,

3.1

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

3.2 Create a new folder and name it as a “CarbonRepo”

3.3

Paste the copied folder on to “CarbonRepo”

3.4 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                               

4.

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

4.1

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

 Image1


4.2

Extract Apache Tomcat package and Create a folder ("wsas") in Tomcat “webapps” folder and paste the WEB-INF folder there

 

image3

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

         5.1 

Open server.xml in Apache Tomcat "conf" folder. Following script tag need to add 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" />

         

        5.2 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”

5.3 HTTPS 8443 port is now open for Apache Tomcat.

 

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:

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

     

 6.2 Replace following tag with exsisting <ServerURL>Tag.

        6.3 If the name of the folder in WSAS webapps is “wsas”,

     

                  Your Final server url should be:


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

7. Now you need to setup carbon context root in carbon.xml.open carbon.xml in your CARBON_HOME/conf directory.Insert "/wsas" (Directory name what you insert in tomcat home/webinf directory.) in web context root tag.

           <WebContextRoot>/wsas</WebContextRoot>

8. Now you need to point out wsas server internal database url in registry.xml and user-mgt.xml.your database located in CARBON_HOME/database directory.

8.1 Open registry.xml in CARBON_HOME/conf directory and change dbconfig tag.

                Syntax :-

                <dbconfig name="wso2registry">
                <url>jdbc:h2:CARBON_HOME\database\WSO2CARBON_DB</url>
                <userName>wso2carbon</userName>
                <password>wso2carbon</password>
                <driverName>org.h2.Driver</driverName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                </dbconfig>

                 Ex : -

              <dbconfig name="wso2registry">
        <url>jdbc:h2:D:\Projects\Carbon\WSAS\CarbonRepo\database\WSO2CARBON_DB</url>
       <userName>wso2carbon</userName>
        <password>wso2carbon</password>
        <driverName>org.h2.Driver</driverName>
        <maxActive>50</maxActive>

<maxWait>60000</maxWait>
        <minIdle>5</minIdle>
  </dbconfig>

 

8.2 Open user-mgt.xml in CARBON_HOME/conf directory and change database tag.

                Syntax : -

                <Database>
                <URL>jdbc:h2:CARBON_HOME\database\WSO2CARBON_DB</URL>
                <UserName>wso2carbon</UserName>
                <Password>wso2carbon</Password>
                <Dialect>h2</Dialect>
                <Driver>org.h2.Driver</Driver>
                <maxActive>30</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                </Database>

 

               Ex : -

<Database>

       <URL>jdbc:h2:D:\Projects\Carbon\WSAS\CarbonRepo\database\WSO2CARBON_DB</URL>
<UserName>wso2carbon</UserName>
        <Password>wso2carbon</Password>

<Dialect>h2</Dialect>

        <Driver>org.h2.Driver</Driver>
        <maxActive>30</maxActive>
        <maxWait>60000</maxWait>
        <minIdle>5</minIdle>
</Database>

 

9. 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 numbers in WSAS Axis2.xml. Open Axis2.xml in CARBON_HOME/conf folder & 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>

10.

Create folders as a "common/endorsed"

in TOMCAT_HOME and copy all three jars in side your WSAS pack/lib/endorsed folder.

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

     

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

             

             Start tomcat as,

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

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

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

                https://localhost:8443/wsas/carbon

  Copy CARBON_HOME/lib/log4j.properties to TOMCAT_HOME/webapps/wsas/WEB-INF/classes. This will create WSAS related log files inside TOMCAT_HOME/bin/logs folder.

Author: Chamara Silva is a Senior Software Engineer at WSO2. [email protected]

 

About Author

  • Chamara Silva
  • Technical Lead
  • WSO2 Inc.