WSO2 Governance Registry 3.0.1 deployment on Jboss 5.1.0 GA with Oracle 10g

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By Krishantha Samaraweera
  • 28 Oct, 2009
Step 1
Download WSO2 G-Reg-3.0.1 from here. Extract the downloaded zip into a directory. And copy conf, database, repository, bam and resources directories in to a new folder. Here after, we will refer it as greg-repo (eg:- /home/krishatha/greg-repo)
 
Step 2
Lets refer to your jboss installation directory, JBOSS_HOME. Go to JBOSS_HOME/server/default/deploy directory and create a new folder, wso2greg.war.Now, copy wso2greg-3.0.1/webapps/ROOT/WEB-INF to JBOSS_HOME/server/default/deploy/wso2greg.war
 
Step 3
Configuring jboss ssl connector as given below.
 
(a) First, you should probably shut down the JBoss server as you do this step.
In the JBoss directory, there should be a file called server.xml: 
JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml
This file includes information about what web features to turn on when the server starts up.Inside this file, there should be a part that looks like this 
<!--<Connector protocol="HTTP/1.1" SSLEnabled="true"
port="8443" address="${jboss.bind.address}"
scheme="https" secure="true" clientAuth="false"
keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore"
keystorePass="rmi+ssl" sslProtocol = "TLS" />--> 
(b)Make the following changes: 
            (i). Uncomment the block
            (ii). Change the port to 8443
            (iii). Change the keystore password to the password used.
 
The end result should look something like this: 
<!-- SSL/TLS Connector configuration using the admin devl guide keystore-->
<Connector protocol="HTTP/1.1" SSLEnabled="true"
port="8443" address="${jboss.bind.address}"
scheme="https" secure="true" clientAuth="false"
keystoreFile="/home/krishatha/greg-repo/resources/security/wso2carbon.jkskeystorePass="wso2carbon" sslProtocol = "TLS" />
Make sure to give the exact location of wso2carbon.jks as highlighted above.
Note: you can use your own keystore file if required. 
 
Step 4
Now we must do the necessary configurations in a set of config files shipped with WSO2 G-Reg. We will update carbon.xml, axis2.xml, registry.xml, transports.xml and user-mgt.xml which can be found at greg-repo/conf directory. 
 
(a) Edit the carbon.xml in greg-repo/conf and put /wso2greg as the WebContextRoot 
<WebContextRoot>/wso2greg</WebContextRoot>
the webcontextroot will be the name you used to create war distribution in JBOSS_HOME/server/default/deploy/wso2greg.war/
 
(b) Edit the same carbon.xml and set backend sever URL as below. 
<ServerURL>https://yourIP:8443/wso2greg/services/</ServerURL>
It is recommended to use your IP rather than using localhost or hostname.
Note that we have configured JBoss to run on 8443 port now.
 
(c)Now open axis2.xml to change the http and https ports in the Transports section of axis2.xml 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>
 (d) Edit the transports.xml as follows: https and http ports of the transport section can be changed as follows. 
<transport name="http" class="org.wso2.carbon.server.transports.http.HttpTransport">
<parameter name="port">8080</parameter>
 
<transport name="https" class="org.wso2.carbon.server.transports.http.HttpsTransport">
<parameter name="port">8443</parameter>
 (e) Open registry.xml and update DB configurations as follows: 
<dbConfig name="wso2registry">
<url>jdbc:oracle:thin:@hostname:1521:SID</url>
<userName>wso2</userName>
<password>wso2</password>
<driverName>oracle.jdbc.driver.OracleDriver</driverName>
<maxActive>80</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>
Note that the DB configuration used here is for Oracle and you can set the DB configuration to any other supported DB accordingly.
 
(f) Open user-mgt.xml and update DB configurations as follows: 
<Database>
<URL>jdbc:oracle:thin:@hostname:1521:SID</URL>
<UserName>wso2</UserName>
<Password>wso2</Password>
<Dialect>oracle</Dialect>
<Driver>oracle.jdbc.driver.OracleDriver</Driver>
<maxActive>30</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</Database>
(g) In order to create G-Reg database structure, you will need to use the oracle.sql found at wso2greg-3.0.1/dbscripts/ and execute the script using your favourite sql script executer. In this tutoril I will use sqlplus command line tool for the script exections. The steps are given below:
  1. Open a new command line window and run sqlplus (SQL Command Line) tool. You will need to add ORACLE_HOME/bin to PATH in order to use the sqlplus tool directly from any location.
  2. Now you must connect the SQL command line to the database which your instance of Oracle uses.
    1. Type "connect USERNAME."  USERNAME is the name of the database user, please enter that and then press enter. 
    2. The command line will prompt you for a password.  Type the database password and press enter.
    3. The command line should display the response "Connected."
    4. If you are in doubt whether you have connected with the right username, type "show user"  and the command line should give you back your username. 
  3. Type "@/path/to/your/wso2greg-3.0.1/dbscripts/oracle.sql"  and press enter.  Remember to type the entire path. (in my case "@/home/krishantha/Desktop/final-packs/wso2greg-3.0.1/dbscripts/oracle.sql")
  4. You should see a bunch of different processes in the command line window, and when they are completed, you will be back to the "SQL>" prompt.  Please close the command line.  You are finished with running the script. 
Note that the DB configuration used here is for Oracle and you can set the DB configuration to any other supported DB accordingly. Now you have done with configuration changes. More details on setting up G-Reg with Oracle can be found at here.
 
Step 5
To use the G-Reg dashboard and BAM functionality, you need to do a few modifications to the database textbase structure files under greg-repo/repository/dataservices.
Our BAM component supports only for H2 database. Therefore you need to edit BAMDataCollectionDS.dbs and BAMStatQueryDS.dbs and put the absolute paths to the BAM H2 database.
 
Open the greg-repo/repository/dataservices/BAMDataCollectionDS.dbs and edit as below. Note that I have replaced the relative H2 DB path with absolute path. 
<data name="BAMDataCollectionDS">
<config id="bamDataSource">
        <property name="org.wso2.ws.dataservice.driver">org.h2.Driver</property>
        <property name="org.wso2.ws.dataservice.protocol">jdbc:h2:/home/krishatha/greg-repo/bam/database/WSO2BAM_DB</property>
        <property name="org.wso2.ws.dataservice.user">wso2bam</property>
        <property name="org.wso2.ws.dataservice.password">wso2bam</property>
        <property name="org.wso2.ws.dataservice.minpoolsize">5</property>
        <property name="org.wso2.ws.dataservice.maxpoolsize">20</property>
        <property name="org.wso2.ws.dataservice.autocommit">false</property>
 </config>
Now open the greg-repo/repository/dataservices/BAMStatQueryDS.dbs and edit as below. Note that I have replaced the relative H2 DB path with absolute path. 
<data name="BAMStatQueryDS">
    <config id="bamDataSource">
        <property name="org.wso2.ws.dataservice.driver">org.h2.Driver</property>
        <property name="org.wso2.ws.dataservice.protocol">jdbc:h2:/home/krishatha/greg-repo/bam/database/WSO2BAM_DB</property>
        <property name="org.wso2.ws.dataservice.user">wso2bam</property>
        <property name="org.wso2.ws.dataservice.password">wso2bam</property>
        <property name="org.wso2.ws.dataservice.minpoolsize">5</property>
        <property name="org.wso2.ws.dataservice.maxpoolsize">20</property>
        <property name="org.wso2.ws.dataservice.autocommit">false</property>
    </config>
Step 6
Now you have to copy oracle driver class to the correct location. In my case I have used ojdbc14.jar. 
copy ojdbc14.jar into greg-repo/repository/components/lib
 
Step 7
You also need to copy the wso2greg-3.0.1/lib/log4j.properties file into JBOSS_HOME/server/default/deploy/wso2greg.war/WEB-INF/classes, and JBOSS_HOME/common/lib/log4j.jar to JBOSS_HOME/server/default/deploy/wso2greg.war/WEB-INF/lib
 
Step 8
Now  copy the jar files in wso2greg-3.0.1/lib/endorsed/ into JBOSS_HOME/lib/endorsed. You need to copy the followig jar files.
  1. xalan-2.7.0.wso2v1.jar
  2. xercesImpl-2.8.1.wso2v1.jar 
  3. xml-apis-1.3.04.wso2v1.jar
Step 9
We have completed the required configurations. Now, open a new command window and change the directory to JBOSS_HOME/bin. Define an environment variable called CARBON_HOME and set the path to your greg-repo directory. 
 
In windows; set CARBON_HOME=C:\greg\greg-repo
In linux; export CARBON_HOME=\home\user\greg\greg-repo 
 
Start JBoss from the same command window/shell. To start JBoss with the "-b [IP]" option use the following commands:
 
eg:- run.bat -b 10.100.1.123
       sh run.sh -b 10.100.1.23
 
After starting the WSO2 Governance Registry, you can access the management console using below URL
 

Author:

Krishantha Samaraweera, Technical Lead -Quality Assurance, krishantha AT wso2 dot com