Thursday, August 4, 2011

[WSO2 GREG] How to deploy WSO2-greg-4.0.0 on WebLogic

Here, I have used WSO2-greg-4.0.0, WebLogic 11g and JDK 1.6 to explain about the "How to deploy the WSO2-greg-4.0.0 on WebLogic".

The subtopics of the above  subject are  as follows:

1) How to create a domain in WebLogic.
2) Create a war file from WSO2-greg-4.0.0.
3) How to configure the greg repository.
4) How to configure the newly created domain.
5) Deploy the greg web app archive file (war file) on WebLogic.

How to create a domain in WebLogic.

You can follow the steps which I have mentioned in CreateNewDomain.pdf to create a new domain.

Create a war file from WSO2-greg-4.0.0.

I) Create a directory in your system (we named it as WAR_DIR) and copy the WEB-INF directory which is under wso2greg-4.0.0/lib/core  to  WAR_DIR.

II) If you want to enable the carbon logging in WebLogic , copy the file which is under wso2greg-4.0.0/lib to the WAR_DIR/WEB-INF/class directory.

III) Copy all the libraries under wso2greg-4.0.0/lib/api to the WAR_DIR/WEB-INF/lib.

You can do the above three steps using an ant task (executing ant createWAR). You only need to run that command from wso2greg-4.0.0/bin. After executing that command relevant WEB-INF directory will be created in directory under wso2greg-4.0.0/tmp/wso2 .

iv) Navigate your command shell to WAR_DIR directory and execute the following command to create the web app archive file.
jar -cvf ./greg.war ./* 

How to configure the greg repository.

I) You need to create a new directory in your file system(we named it as greg-repo) and it will be the repository in our deployment.

II) Copy the repository which is under wso2greg-4.0.0 to the greg-repo.

III) Now, you need to configure the carbon.xml, axis2.xml, registry.xml, and user-mgt.xml.
(You can find those files under wso2greg-4.0.0/repository/conf directory)

Open the carbon.xml and changed the values of the  ServerURL and  WebContextRoot.
Open the axis2.xml and change the http and https ports according to WebLogic settings.
<transportreceiver class="org.wso2.carbon.core.transports.http.HttpTransportListener" name="http">  
<parameter name="port">7001</parameter>  
<transportreceiver class="org.wso2.carbon.core.transports.http.HttpsTransportListener" name="https">  
<parameter name="port">7002</parameter>  

Open the registry.xml and change the database URL of data base configuration as follows.
You need to add the absolute path of WSO2CARBON_DB as the database url.

Open the user-mgt.xml and change the value of the database url property.
(Keep remember to add the absolute path of WSO2CARBON_DB as the url).
<property name="url">jdbc:h2:/home/ajith/greg-repo/repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE</property>

Deploy the greg web app archive file (greg.war file) on WebLogic.

Copy xalan-*.jar, xercesImpl-*.jar and xml-apis-*.jar from  wso2greg-4.0.0/lib/endorsed to the ext directory of your JDK installation. (/home/ajith/programes/jdk1.6.0_26/jre/lib/ext)

I) Open a new command shell and set the CARBON_HOME environment variable. (Linux : export
CARBON_HOME=/home/ajith/greg-repo ,
Windows: set CARBON_HOME=/home/ajith/greg-repo)

II) Locate your command shell to the bin (Oracle/Middleware/user_projects/domains/greg_domain/bin) directory of your domain and execute the startWebLogic command. (in linux sh

III) After successfully started the WebLogic server locate your browser  to the http://localhost:7001/console and login using the credentials which you have entered during the domain creation.

IV) After login to AdminiServer Console , navigate your browser to Home>Summary of Environment> Summary of Servers >AdminServer and select the Keystores tab.
And also change the Keystores: to “Custom Identity and Custom Trust” and save it.

V) Enter the following values to the relevant fields of the  keystores configuration. 

Identity section.

Custom Identity Keystore: /home/ajith/greg-repo/repository/resources/security/wso2carbon.jks  
Custom Identity Keystore Type: JKS  
Custom Identity Keystore Passphrase: wso2carbon  
Confirm Custom Identity Keystore Passphrase: wso2carbon
Trust section.
Custom Trust Keystore: wso2carbon  
Custom Trust Keystore Type: JKS  
Custom Trust Keystore Passphrase: wso2crbon  
Confirm Custom Trust Keystore Passphrase: wso2carbon  

VI) Click on the SSL tab on WebLogic AdminServer console and enter the following values for the relevant fields.

Private Key Alias: wso2carbon  
Private Key Passphrase: wso2carbon  
Confirm Private Key Passphrase: wso2carbon

VII) Navigate the AdminServer console to the deployment section and start to install the greg.war file clicking on the “install” button.

VIII) Browse the directory which is contain the greg.war. Then go forward with default configurations until the installation is complete.

IX) After finishing the installation , you should see the greg.war deployment on your command shell.
X) After successfully started the WSO2-greg-4.0.0 server , locate your browser to https://localhost:7002/greg/carbon on your favorite browser and login using the default user name(admin) and password(admin).