Thursday, March 3, 2011

How to deploy WSO2-BPS in Apache Tomcat


This blog post explains how to deploy WSO2-BPS in Apache Tomcat servlet container with a few configuration steps. Even for any other WSO2 product these steps will be compatible.

Tested Environment
- Ubuntu 10.04
- WSO2BPS-2.0.2
- Apache-Tomcat-6.0.12
- Java version "1.6.0_21"

Step 1
  • Extract the downloaded distribution of wso2bps-2.0.2 into a directory.
  • Copy repository and resources directories in to a new folder. Say it is carbon-repo (i.e:- /opt/temp-svn/products/carbon-repo)
Step 2
  • Extract the downloaded distribution of apache-tomcat-6.0.32 into a directory, CATALINA_HOME.
  • Go to CATALINA_HOME\webapps directory and create a new folder, bps
  • Copy wso2bps-2.0.2/lib/core/WEB-INF to CATALINA_HOME/webapps/bps
Step 3
  • We need to enable https in tomcat. Therefore, edit CATALINA_HOME\conf\server.xml by adding the following entry.
<connector maxhttpheadersize="8192" port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true" SSLEnabled="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile = "/opt/temp-svn/products/carbon-repo/resources/security/wso2carbon.jks"
keystorePass="wso2carbon" />
  • Make sure to give the exact location of wso2carbon.jks as highlighted above.
    Step 4
    • We have done the configurations required in tomcat. Now, we must do the necessary configurations in a set of configuration files shipped with WSO2 BPS. We will update carbon.xml, axis2.xml, registry.xml and user-mgt.xml which can be found at carbon-repo\repository\conf directory.
    • First, open carbon.xml and update the ServerURL and WebContextRoot elements as follows. It is required to change the WebContextRoot to match with the web application directory name we have given in step2. In our case, it is bps.
    <ServerURL>https://localhost:8443/bps/services/</ServerURL>
    
    <WebContextRoot>/bps</WebContextRoot>
    
    • Note that we have configured tomcat to run on 8443 port. Save and close carbon.xml.
    • Open registry.xml and update DB URL as follows.
    <dbConfig name="wso2registry">
    <url>jdbc:h2:/opt/temp-svn/products/carbon-repo/repository/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>
    
    
    • Open user-mgt.xml and update database URL as follows.
    <Property name="url">jdbc:h2:/opt/temp-svn/products/carbon-repo/repository/database/WSO2CARBON_DB</Property>
    
    • Make sure to specify the absolute path of the WSO2CARBON_DB in both of the above elements.
    • Open axis.xml and change the ports in the http and https transport receivers 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>

    Step 5
    • Add the jars included in CARBON_HOME/lib/endorsed to CATALINA_HOME/lib.
    • Now, open a new command window and change the directory to CATALINA_HOME/bin.
    • Define an environment variable called CARBON_HOME and set the path to your carbon-repo directory.
                 eg - export CARBON_HOME=/opt/temp-svn/products/carbon-repo
    • Start the Tomcat server and access https://localhost:8443/bps/services/ in browser.

    1 comment:

    nuwan said...

    Hi Denis,

    Can you update this post to reflect the new setup.

    [1] the security directory is now at /repository/resources
    [2] you need to copy lib/api jars in to web-in/lib

    /Nuwan