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.

[1]www.dhamma.org

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(Transaction.java:474)
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.commitTransaction(EmbeddedRegistry.java:403)
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(EmbeddedRegistry.java:594)
at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:545)
at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.setupMounts(RegistryCoreServiceComponent.
java:250)

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">
<url>jdbc:oracle:thin@qcdvcn1001-vip.dev.rsft.net:15000:DEV541</url>
<userName>wso2_esb</userName>
<password>wso2_esb</password>
<driverName>oracle.jdbc.driver.OracleDriver</driverName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>

<dbConfig name="esbMountRegistry">
<url>jdbc:oracle:thin@qcdvcn1001-vip.dev.rsft.net:15000:DEV541</url>
<userName>wso2_greg</userName>
<password>wso2_greg</password>
<driverName>oracle.jdbc.driver.OracleDriver</driverName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>

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">
<url>jdbc:oracle:thin:wso2_esb@qcdvcn1001-vip.dev.rsft.net:15000:DEV541</url>
<userName>wso2_esb</userName>
<password>wso2_esb</password>
<driverName>oracle.jdbc.driver.OracleDriver</driverName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>

<dbConfig name="esbMountRegistry">
<url>jdbc:oracle:thin:wso2_greg@qcdvcn1001-vip.dev.rsft.net:15000:DEV541</url>
<userName>wso2_greg</userName>
<password>wso2_greg</password>
<driverName>oracle.jdbc.driver.OracleDriver</driverName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>

[1]http://wso2.org/library/tutorials/2010/11/setup-wso2-esb-cluster-wso2-greg


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 setup.py 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.
cd
./bootstrap
./configure --with-qpid-checkout=
make
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 msgstore.so

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

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.

[1]http://anonsvn.jboss.org/repos/rhmessaging/store/tags/

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

http://service.endpoint/ServiceName?name1=value1&name2=value2...

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="http://ws.apache.org/ns/synapse">
<address uri="http://service.endpoint/" format="get" >
<suspendOnFailure>
<initialDuration>10000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>30000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>


You can simply send the content of the request like this

<ServiceName>
<name1>value1</name1>
<name2>value2</name2>
</ServiceName>

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,
Ex:
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.

<ServiceName>
<name1>value1</name1>
<name2>value2</name2>
<name3><![CDATA[xmlcontent]]></name3>
</ServiceName>

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.