Thursday, August 5, 2010

How to deploy WSO2 Gadget Server on tomcat

Applies To: wso2gs-1.1.0.zip ( Carbon 3.0.0)
apache-tomcat-6.0.20

Step 1
Download WSO2 Gadget Server -1.1.0 from http://wso2.org/downloads/gadget-server. Extract the downloaded zip into a directory. And copy repository and resources directories in to a new folder. Here after, we will refer it as gs-repo (eg:- /home/krishatha/gs-repo)

Step 2
Lets refer to your tomacat installation directory as CATALINA_HOME. Go to CATALINA_HOME/webapps directory and create a new folder call wso2gs .Now, copy wso2gs-1.1.0/webapps/ROOT/WEB-INF to
CATALINA_HOME/webapps/wso2gs

Step 3
Now you will need to enable HTTPS on Apache Tomcat since WSO2 Gadget Server runs over HTTPS. To do this, access the server.xml file located at CATALINA_HOME/conf and uncomment the following
and fill as below.


<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile ="/home/krishatha/gs-repo/resources/security/wso2carbon.jks"
keystorePass="wso2carbon"/>



One could find the wso2carbon.jks file inside the CARBON_HOME/repository/resources/security/ directory in WSO2 Gadget Server installation home (CARBON_HOME)

Make sure to give the exact location of wso2carbon.jks
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 Gadget Server. We will update carbon.xml, axis2.xml, registry.xml, mgt-transports.xml and user-mgt.xml which can be found at gs-repo/repository/conf directory.

(a) Edit the carbon.xml in gs-repo/repository/conf and put /wso2gs as the WebContextRoot


<WebContextRoot>/wso2gs</WebContextRoot>



the WebContextRoot will be the name you used to create war distribution in CATALINA_HOME/webapps

(b) Edit the same carbon.xml and set backend sever URL as below.


<ServerURL>https://your-ip:8443/wso2gs/services/</ServerURL>


It is recommended to use your IP rather than using localhost or hostname.
Note that we have configured Tomcat 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 mgt-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:h2:/home/krishatha/gs-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>


Note that you have to use absolute path to the H2 DB.

(f) Open user-mgt.xml and update DB configurations as follows:

<Property name="url">jdbc:h2:/home/krishatha/gs-repo/repository/database/WSO2CARBON_DB</Property>
<Property name="userName">wso2carbon</Property>
<Property name="password">wso2carbon</Property>
<Property name="driverName">org.h2.Driver</Property>
<Property name="maxActive">50</Property>
<Property name="maxWait">60000</Property>
<Property name="minIdle">5</Property>


Note that you have to use the absolute path to the H2 DB.

Step 5
You also need to copy the wso2gs-1.1.0/lib/log4j.properties file into CATALINA_HOME/webapps/wso2gs/WEB-INF/classes

Step 6
Now copy the jar files in wso2gs-1.1.0/lib/endorsed/ into CATALINA_HOME/lib. 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 7
We have completed the required configurations. 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 gs-repo directory.

In windows; set CARBON_HOME=C:\gs\gs-repo
In linux; export CARBON_HOME=/home/krishatha/gs-repo


Start tomcat server from the same command window/shell.

eg:- catalina.sh run
catalina.bat run

After starting the WSO2 Gadget Server, you can access the management console using below URL

https://your-ip:8443/wso2gs/carbon

Tuesday, July 20, 2010

How to install oracle XE on ubuntu 10.04 64 bit

Recently I had to go though the pain of installing oracle on Ubuntu again in my new laptop. Two years back I did the same installation on Ubuntu 7.10 and cost me two days to complete the installation. But this time things are rather easy.

So here we go.

Before installing
1. sudo apt-get install bc

Then I installed the packet.
sudo dpkg --force-architecture -i oracle-xe_10.2.0.1-1.0_i386.deb

Then I configured the system:
sudo /etc/init.d/oracle-xe configure

Then follow the below steps

1. export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
2. export ORACLE_SID=XE
3. export PATH=$ORACLE_HOME/bin:$PATH
4. sudo apt-get install ia32-libs
5. sudo /etc/init.d/oracle-xe start

If you get bash: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus: No such file or directory error then killer might be missing step 4
sudo apt-get install ia32-libs

References :
[1] http://littlebrain.org/2008/05/12/how-to-install-oracle-xe-in-ubuntu-64-bit/

Guide to install oracle using apt get
[2] http://www.webxpert.ro/andrei/2009/05/31/instal-oracle-10g-xe-on-ubuntu-server-904-jaunty-jackalope/

Tuesday, May 4, 2010

Start SOA governance with WSO2 governance Registry

WSO2 has recently announced their new release of WSO2 Governance Registry which is based on WSO2 Carbon framework 3.0.0.

It was packed with some exciting and very useful new features. The product can be used not only to govern you SOA metadata, but also as a registry-repository for your organization. Most interestingly the product is open source and available freely under Apache license. First version (0.1) of the product was released in December, 2007. Thus, the product has been matured over two years and good enough to cater your SOA governance requirement easily.

List of new features of the release as follows.

New Features
============================

* Gadgets for impact analysis on services and registry resources
* WSDL custom view
* Dynamic Handler configuration
* Handler simulator
* Tree-based Resource view
* API to govern SOA artifacts
* Complete Web Services API for Registry
* Improved options for Service discovery
* WS-Discovery support
* Scripting support for lifecycle management
* Improved P2 based provisioning and feature management support
* Support for adding remote mounts
* Platform, and Group/Cluster based deployment model
* Support for multiple server instances
* E-mail verification for subscriptions
* Support for deleting tags and comments
* Support for PostgreSQL DBMS
* Paged activity and resource search
* Hierarchical permission model with granular and extensible permissions
* Ability to upload metadata (in addition to importing)
* Governance Archive for uploading WSDLs and Schemas with imports
* Ability to update resource content by uploading
* Rich text editor for editing text resources
* XML editor for editing handler, lifecycle and service UI configurations

Thursday, October 29, 2009

How to capture popup windows using selenium.

I am going to discuss on selenium popup handling specifically with selenium RC. I was searching though internet for a while to find a solution for processing of popups though selenium.But I was unable to find best fit answer for my test scenario. I wanted to capture pop-up window do some processing then close the popup and get back to parent window again.Anyway by following the reference guides and other available materials I was able to implement the the above mentioned test scenario.

As per my understanding selenium IDE supports capturing popup windows but get back to parent window is not supported. I tried several times and failed to set focus to parent window again. Selenium API doc says, in order to select parent window again, use selectWindow() methods with null parameter. But that didn't work for me. selenium RC was fail to select the parent window again. There are several API methods available in selenium to detect required references for popup windows. Those are

selenium.selectWindow();
selenium.getAllWindowIds();
selenium.getAllWindowNames();
selenium.windowFocus();
selenium.waitForPopUp();
selenium.close();


In my case,I have followed implementation give below to write the test scenarios in junit.

click the popup window link

selenium.click("link=Feed");

Get the pop up window ID.

String feedWinId = selenium.getEval("{var windowId; for(var x in selenium.browserbot.openedWindows ) {windowId=x;} }");

Select the popup window.In order to select it, you must somehow identify it. Various identification methods are available with selectWindow() function see http://release.seleniumhq.org/selenium-remote-control/0.9.0/doc/java/ for more details

selenium.selectWindow(feedWinId);

Set focus to popup window.

selenium.windowFocus();

//Then do some proccssing

close the popup

selenium.close();

select parent window again. You need to know the window title or name

String[] winFocus;
String winTitle;
winFocus = selenium.getAllWindowTitles();


If there is more than one open windows you have to iterate though winFocus array and find the correct window to set the focus.

winTitle = winFocus[0];

if (winTitle.equalsIgnoreCase("WSO2 Management Console")) {
selenium.selectWindow(winTitle);
}


If you need to wait for the popup then use

selenium.waitForPopUp(winID, time-ms);

I hope above instructions will help you in dealing with pop ups. Please feel free to comment and ask questions

Source code of the test : https://wso2.org/repos/wso2/branches/commons/qa/web-test-framework/2.0.2/registry/src/test/java/org/wso2/carbon/web/test/registry/FeedsTest.java

Thursday, October 22, 2009

WSO2 SOA workshop - Santa Clara, CA | November 3rd 2009

Join us in Santa Clara, CA on the 3rd of November for a full-day interactive workshop on real world best practices for SOA. Learn how to map specific business requirements to concrete SOA development.

Tuesday, August 18, 2009

WSO2 Governance Registry 3.0.0 installation on Jboss 5.0 with Oracle 10g

WSO2 G-Reg, one of the leading open source SOA governance solution available. The latest release of the WSO2 G-Reg support multiple application servers along with most common production databases.This post list down the steps to deploy G-Reg 3.0.0 on Jboss 5.0 GA using oracle 10g.

Step 1
Download WSO2 G-Reg-3.0.0 from here. Extract the downloaded zip into a directory. Copy conf, database, repository and resources directories in to a new folder. Here after, we will refer it is greg-repo (i.e:- /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.0/webapps/ROOT/WEB-INF to JBOSS_HOME/server/default/deploy/wso2greg.war

Step3
Now configuring jboss ssl connector as given below.

a. First up, 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.jks"
keystorePass="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 set backend sever URL as below.

<ServerURL>https://IP: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.

b. Edit the same carbon.xml 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/

c. Then open axis2.xml, We must change the http and https ports in In 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>

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 from here.

Step 5
Now you need 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/extensions


step 6
You also need to copy the wso2greg-3.0.0/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

step7
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.

ex:- run.bat -b 12.34.56.78 OR
./run.sh -b 12.34.56.78


WSO2 G-Reg will be started successfully. You can access the management console using https:\\IP:8443\wso2greg\carbon

Related posts: How to deploy WSO2 WSAS-3.* on JBoss

Sunday, April 26, 2009

Deploying and securing web service with Username Token Policy

Here Charitha Kankanamge, one of my colleague demonstrate deploying a java web Service on WSAS and Securing it with Username Token Policy

Stat counter