Thursday, December 30, 2010

My stay at Dhamma Kuta for 11 days

I thought of writing a blog post what I have done during my year end vacation which is the best few days i have spend in my life. I am writing this post not to share an intellectual property, but if at least one person get benefit from this it will be the best thing for me. I will be keep on updating more information time to time so this post will be changed in coming days.I have applied the Vipassana 10 day meditation course (if you are a Sri Lankan when you hear this words meditation course you might get bored, but they simply use this in the western pattern so that western people will also understand things , just forget about the word...) in May and hopefully I was able to start it on 18th of December to 29th of December at Dhamma Kuta which is one of the Vipassana meditation center in Sri Lanka. For more information about the courses you can follow up them from their website[1], course schedules and how the things are rules etc. I will be posting something which does not exist in the web site.

My experience

When it comes to the experience best part will be what I have gain from doing Vipassana meditation, but it's not the correct time for this, I am continuing meditation at home and I will be posting on it in future, this part will be about my experience during the 10 days. I had a very strange, interesting and peaceful feeling during my stay at Dhamma Kuta which I haven't got in my life before. It was a very simple ten days I spend. Students are not suppose to talk to anybody (if you need something you simply have to talk to Dhamma helpers and you can talk to the teacher few word) and I consider that as one of the best experience. You will be given a simply cell which contains a bed, cloth rack and a small table. So whole few days were spend alone, simple food, and keep on meditating for more than 10 hours per day (don't get scared this can be done and thousands and thousands of people are attending these courses all over the world). So it was peaceful calm and quite 10 days in my life. But since it was away from the home and I was alone I felt like running away back home on the second day but hopefully I was strong enough to stay with a good determination.

What you should bring

I think this part will be useful if you are going for the first time, if you are a foreigner who is going to travel to Sri Lanka to attend to this course this part will be useful. This list is if you are going to Dhamma Kuta, but there will be slight changes if you are going to one of the other two centers in Sri Lanka. If you bring everything you want you will hardly speak to the management so you can keep the noble silence very effectively.
  • You need to bring cloths which is enough to survive 10 days and I would say simple easy to wear cloths would be fine. Since this part of the country is pretty cold you need to bring some other stuff which protect you from the cold environment. But the management is providing blankets for you, if it's difficult to bring blankets, still you will be good.
  • Slippers, bed sheet, pillow cover, torch will be very helpful.
  • Soap, brush, tooth paste etc.
  • I will update the list time to time when things get remind me.
This post is not completed yet.


Thursday, December 16, 2010

WSO2 product cluster with registry replication in Oracle

I recently notice an obvious mistake users doing when they configure WSO2 product cluster and use WSO2 G-Reg as the central repository for the replication among the cluster nodes. You can find a guide on how to set this up in an WSO2 Oxygen Tank tutorial [1] and there we are using Oracle as the database.

If you go through this you will see we are doing two registry mountings in all the cluster nodes, so every cluster node is having two database configuration, one for the local registry database configuration and one for the mount registry database configuration (configuration of the central registry database).

When it comes to Oracle, normally users are using a same database URL and differentiate among different databases by changing the user name and password. This works without any issue, but when it comes to mounting we are referring the URL of the database configuration and we expect you will put different URL values for two database configuration (local registry and config and governance mounting). So with Oracle users will simply not aware of this and use different username password and they get following error.

java.sql.SQLException: Total number of available connections are less than the total number of committed connections
at org.wso2.carbon.registry.core.jdbc.utils.Transaction$ManagedRegistryConnection.commit(
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.commitTransaction(
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(
at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(
at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.setupMounts(RegistryCoreServiceComponent.

So this error comes when someone try to mount from it's own database, if you use a configuration like below obviously we are throwing this exception.

<dbConfig name="wso2registry">

<dbConfig name="esbMountRegistry">

You can see above two URL's are same but username password are different.

So the solution for this issue is differentiate the URL by giving username in the database URL before the "@" sign. So the dbconfig elements of the cluster node registry.xml will looks like this.

<dbConfig name="wso2registry">

<dbConfig name="esbMountRegistry">


Tuesday, December 7, 2010

How to monitor and manage Apache Qpid C++ broker

In this blog post I am describing how to setup the Qpid C++ broker monitoring. First I have to say you that to do this you need to checkout the complete qpid source code which include Java/python/C++ etc. After successfully checking out make sure you have installed python in your machine.

Go to python directory and run the build command for python like this

python build

Go to command directory inside python directory and set the environment variable PYTHONPATH to the python directory (not to command directory).

Inside the command directory you can see set of python scripts which you can used to manage running Apache Qpid C++ broker.

Successfully doing all of these you can try running all the scripts with --help option and see all the possible options. With these scripts I have done Qpid monitoring and queue create/deleting topic creation/deletion like operation and i will be writing more about these things in few more blog posts.

Apache Qpid C++ broker persistency

I have been doing some Apache Qpid C++ broker work during last few weeks and I thought I should write some important things I learned during Apache Qpid configuration process. In this blog post I will be explaining how to configure persistent with Apache Qpid C++ broker.
To add persistence to Apache Qpid you have to use another project which maintained by RedHat and you first need to check out[1] the appropriate release tag which sync with the Apache Qpid release you are using.

First you should have a working Apache Qpid C++ broker build in your machine with a full checkout of the source of the release. If you are using a release please get a check out of the appropriate tag.

Now you have two checkouts Qpid complete checkout from the tag and message-store checkout from redhat sub version repository for the appropriate Qpid release.
Now go through the README file of the message store and install required softwares to build the message store successfully by running below commands.
./configure --with-qpid-checkout=
make install

Now point your LD_LIBRARY_PATH to /lib/.libs and go to the place where you have build Apache Qpid C++ broker and run the qpidd like below.

./qpidd --load-module

After you start this successfully you can use persistent queues with Apache Qpid C++ broker. You can run ./qpidd --load-module -h to see the available options with the loaded module

To use the queue persistence please create durable queues, I will be writing few more blog posts on how to manage Apache Qpid C++ broker which will describe how to monitor C++ broker and how to create queues, topic and exchanges using python scripts provided in Qpid.


Friday, November 19, 2010

"java.lang.NoClassDefFoundError: and" error when Qpid start on Windows

I recently got this error (CDNF Exception, instead of the class name it display the text "and" as the class name ) when I try to start Apache Qpid using qpid-sever.bat script. This is a weired error because I noticed WSO2 products were starting nicely on my Windows installation and later I found that this happens if you have a directory with space in your path to QPID_HOME. This is simply something to do with the qpid-server.bat script and I hope to look in to the issue soon I get time.

So if anyone get this error when you start Qpid on windows simply fix the path by moving it to C:\ or somewhere you don't get a directory with space in it in QPID_HOME.

Dr Ruwan Ekanayaka best Doctor ever seen

I used to go to channel my fathers cardialogy physician (I am not sure about the designation but I guess this is enough) Dr Ruwan Ekanayaka. When I go there we have to stay in that place more than three hours and normally what I am doing is keep looking the way people come and go in that hospital. Very interesting thing I noticed is when people coming out of the doctors room, I would say almost all the patients are having very pleasant smile in their faces. This is actually not something very common with all the doctors.
When you go inside, you'll see very polite, very simple looking (wearing huge old spectacles) old doctor who used to speak in a very low voice. It's not the polite and pleasant words you'll get when you go to some business place, it's something more than that. Today when he asked about some document father started searching the document in an excited mode. Dr said "Kalabala wenna epa .. wadiwenna", it's like "calm down and please sit down". Then he searched the document from fathers file and did the rest of the work.

Finally when the checkup is finished, he looked up and gave a nice smile to me and my father and asked to come after six months. I strongly believe that awesome smile make people to smile when they are coming out of the doctors room. It simply capable of making unaware of all the difficulties we go through during channeling process by staying at the hospital for more than three hours. I consider this person as a very special doctor when I compare with typical consultants in Sri Lanka. It was a very pleasant feeling you get when meet him with the patient. I think my capability of writing is not good enough to describe Dr Ruwan Ekanayaka's awesomeness !

Thank You Doctor !

Saturday, July 10, 2010

Sending XML content as a value in name value pair GET request using WSO2 ESB

In this blog post I am describing on how to invoke a RESTful service which required a GET request with name value pairs in the request including XML content to be there in one of the value. First I will describe on how to invoke a normal RESTful service via ESB.

If you want to send a request to a service like this


First create an address endpoint by keeping the address of http://service.endpoint and make the endpoint type as REST/GET if you are using the UI to configure ESB. So the Endpoint configuration will looks like this.

<endpoint xmlns="">
<address uri="http://service.endpoint/" format="get" >

You can simply send the content of the request like this


No matter what type of request you are sending because when WSO2 ESB start processing the request it sees only a soap message after getting called message builders and message formatters. So you can see that during the endpoint creation I have remove the ServiceName part from the endpoint since we are sending that in the request and when we mark the endpoint format=get Axis2 will add that part in to the HTTP GET request and append the name value pairs to the request and send the message properly.

So this scenario is very simple and now let's see a case where you need to send something more complex in a HTTP GET request. I came across a scenario where we need to send an encoded xml in the GET request including some of the normal name value pairs.

So the HTTP GET request looks like this,
http://service.endpoint/ServiceName?name1=value1&name2=value2&name3=<encoded xml content>

In this kind of a scenario you might get confused on how do you have to send the request. First create an endpoint as if the above configuration by making the format as get. Then,if you are in a position that you can change the incoming request you can simply send the request content like this.


When ESB send the message to the REST endpoint Axis2 will encode the content inside the CDATA and send the message properly as I have showed above. If you are not capable of sending the message with CDATA content you can simply send the required elements in the incoming request and do an XSLT transformation to create the message as above.

Friday, July 9, 2010

Keep live connection in WSO2 products with Mysql Server

When you are configuring WSO2 products with mysql there might be errors coming with normal configuration when you try to access the product console after a reasonable amount of time. So this is not an issue with the product neither Mysql server. You need to specifically configure to keep the connection live for a defined idle time. Please follow up the below steps to increase the timeout and make sure product will try to connect to the database once it timeouts.

1. Open the my.conf file in mysql installed machine( it's it's a linux machine it will be in /etc/my.conf and if it's a windows machine it will be there in your mysql installed directory) and add the following entries

(this is the keep hte idle time out value for three days in seconds and if you want to keep more just increase the value)

2. Open the CARBON_HOME/repository/conf/registry.xml and CARBON_HOME/repository/conf/user-mgt.xml change url of the mysql database configuration like this


appened "?autoReconnect=true" element to the url.

WSO2 ESB and Qpid setup Guide

This document explains how to do ESB + Qpid setup from the scratch which includes setting up ESB/QPID and registry instances and this Guide doesn't contains any internal message flow configurations of ESB. In this setup we are forwarding incoming messages to Qpid from ESB1 and ESB2 instance is picking messages from the Qpid instance and forward to another endpoint. For this scenario I am just explaining on how to setup the initial configuration and will be posting on how to configure message flows of ESB instances.

1. Download Qpid from here and extract Qpid and and open the QPID_HOME/etc/config.xml
change enable ssl false as below.

<!-- Update below path to your keystore location, eg ${conf}/qpid.keystore -->

2. If you want to use qpid in a clustering mode and extract another qpid instance and do the step 1 and edit QPID_HOME/etc/config.xml and change the ports
configuration by editing port and sslport elements.


3. Start Qpid by running QPID_HOME/bin/qpid-server. If you are using a cluster start all the instances.

Configuring ESB instance which is forwarding incoming messages to Qpid instance

1. Create a file in CARBON_HOME/repository/conf/ directory and add the following entries to the properties file.

destination.replyQueue =direct://

In this configuration is the IP address of the machine which Qpid is running and qpidConnectionfactory is a reference we are using for our reference in axis2.xml.

If you are using Qpid in a cluster please create another properties file and define the same configuration with a different file name and let's assume your slave configuration file is

2. Now open the CARBON_HOME/repository/conf/axis2.xml add the following entry

Adding transportRecievers

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">/home/wso2/WSO2_SETUP1/wso2esb-3.0.0-1/repository/conf/</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">qpidConnectionfactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="slave" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">/home/wso2/WSO2_SETUP1/wso2esb-3.0.0-1/repository/conf/</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">qpidConnectionfactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>

Please change the java.naming.privider.url element according to your setup(colored in red).

Adding transportSenders

<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>

3. If you need only one Qpid instance please remove the second parameter list and keep the default configuration(parameter set with name="default") and note the name of the second parameter set is "slave" and
we need to use that configuration to be added in to synapse configuration when we configure failover endpoints.

4. Copy following jars in to CARBON_HOME/repository/components/lib directory and please download the merged jar from the given location and rest of the jars can be found in QPID_HOME/lib directory.

5. Start the ESB instance by running CARBON_HOME/bin/ or .bat file, now it will connect to the Qpid instance running successfully.

Configuring ESB instance which picks incoming messages from Qpid and forward them to the actual service

Perform all the steps from step 1-5 in the ESB in main setup where we call the MemberVerification service directly. This ESB has to configure with Qpid to pick messages from the queues and send the request to the actual
service and once the response comes back put the reponse in to the reply queue defined in file.

But in the file you do not need to add a replyQueue in the configuration and and file looks like this.


Assume is the IP address of the machine where you run the Qpid instance.

I will be posting on how to configure two proxy services in ESB's to perform the above mentioned tasks in near future.

Monday, May 31, 2010

Configuring WSO2 ESB with Apache Qpid Java broker

Even though there are articles written on how to configure Synapse and Axis2 with Apache Qpid, with the latest releases of WSO2 ESB, those instructions are not valid anymore, so I am thinking of giving a small instructions on how to do those changes accordingly with latest ESB releases. WSO2 ESB is running on top of WSO2 Carbon framework which provides core capabilities of security,clustering logging facilities on top of OSGi environment. So obviously WSO2 ESB is running on top of OSGi environment. This concept cause some of the configurations we have to do with Qpid due to conflicting packaging of Apache Qpid artifacts. If we want to use apache Qpid as a client we need to pick few jar from Qpid distribution and copy them to CARBON_HOME/repository/components/lib directory.But two of those artifacts(qpid-commons and mina-core jars) they are using the same packaging structure calleds org.apche.mina.filter so this is become an issue in OSGi environment during the class loading time. So instead of those two artifacts please use the merged artifacts I have hosted her and use this article to do the rest of the configurations to configure WSO2 ESB with Apache Qpid.
If you have any issue with Qpid configuration don't hesitate to post to

Saturday, February 20, 2010

Change the log file name dynamically using system properties

Recently I wanted the start multiple number of server instances using the same configuration so when I start nodes of the same server i should be having different log files for each instance starting in different location. So can be done very easy without writing a new appender or doing anything just configuring your file.

provide your log file name like this

This is really nicely works due to few reasons. Once you set the file like this you can give set a system property for each instance you are starting with the name of "instance.log" and that will be picked before creating the log file and it will create the log file in the given location.

Ex: if you set the value of system property "instance.log" as "Instance1" it will create the log in location repository/logs/Instance1/wso2carbonInstance1.log.

This file name appending works very nicely and in normal scenarios you are not setting any system property and this will create the logs in the default location which is like this : repository/logs/wso2carbon.log. This appending is working very smoothly so you can append anything for the file name or to the directory name and and if you do not set the system property it will simply ignore that.

To get dynamic log files you do not have to write any code other than setting system property and change the files.

Tuesday, February 2, 2010

No such file or directory error when running Java

I recently had to install Ubuntu in to my machine after having some difficulty with my system files later I set up the available settings and started on working and I found this "No such file or directory" error when I run Java command or when I try to start up Intellij Idea or when I try to do a maven build. But this was totally stupid since I can see the file is there in the given path..

This happened because I have installed 64bit OS and used the JDK 32bit version and the error was totally weired to say No such file or directory.

If you get this error please change the JDK version in to 64bit or vice versa, if you have 32bit OS installed.

Sunday, January 31, 2010

First week at New place with the Family

We moved from Galle to Colombo last week and all of the family member are staying at the new place now. We have been living in Galle for years and later due to my fathers health situation we decided to move the Colombo. We rented a house near Nugegoda and relocated from Galle and I thought of writing a blog post on what I'm feeling during the first week of new place.

First I should thank Loku mama, Anoma Nanda, Yamuna Aunty and Micheal Uncle for helping us to get here and I would say that this place is awesome ... and I never expected to be a place like this. House is great and garden is pretty nice, good looking and good one to relax in the evening. My mom was working hard to unpack all the stuff and now we are almost done with the hard job.. I have been eating from cafes for more than four years during my stay at the University and last few months after I start working but now things are much better that I can have food from my mom .. :)
I felt bit boring during first couple of days because when I go out, I don't know anybody in that area nobody waves to me no one laughs and totally different feeling from what I used to have in Galle but I think I will get used to this life and important thing I'm concentrating is that i can always get to my parents within half an hour or may be within an hours from my work place.. that is what I lost last couple of years. Even though we have certain thing to be solved we are pretty good at the new place and thanks all of the relations and friends and neighbors who helped us to make things in to this stage.