Monday, August 20, 2012

BundleDbPersistenceManager.java:901 FATAL error while writing the bundle: deadbeef-cafe-babe-cafe-babecafebabe

I got the below exception when I try to configure Jackrabbit with mysql on Tomcat.


BundleDbPersistenceManager.java:901 FATAL error while writing the bundle: deadbeef-cafe-babe-cafe-babecafebabe
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Þ­¾ïÊþº¾Êþº¾Êþº¾' for key 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_05]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[na:1.7.0_05]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) ~[commons-dbcp-1.2.2.jar:1.2.2]
        at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) ~[commons-dbcp-1.2.2.jar:1.2.2]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.execute(ConnectionHelper.java:473) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.reallyUpdate(ConnectionHelper.java:335) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper$2.call(ConnectionHelper.java:323) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper$2.call(ConnectionHelper.java:319) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper$RetryManager.doTry(ConnectionHelper.java:486) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.update(ConnectionHelper.java:319) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:888) [jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:769) [jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.storeInternal(AbstractBundlePersistenceManager.java:686) [jackrabbit-core-2.4.0.jar:2.4.0]


I was following the instructions here [1], but it doesn't provide the proper instruction on how to edit the repository.xml file. The above issue comes when you give the wrong schemaObjectPrefix
when you edit the repository.xml. If you give the same schemaObjectPrefix for workspace configuration and version configuration it will give you the above error. So when you follow the instructions in [1], you have to make sure that you will give unique schemaObjectPrefix for both configuration. You can download a working repository.xml here.


[1]http://wiki.apache.org/jackrabbit/JackrabbitOnTomcat6

Sunday, April 29, 2012

My Father


I wanted to write a bit about my father for a long time but I didn't have time or may be I was stupid and kind of messed up last 2 months in my life. I would say thats the worst part in my life up to now. Reason why I wanted to write about my father was, he left everyone of us alone on 28th of February 2012.. I was fortunate to see him live, his eyes open, his hands moving few hours before he passed away.
 My father is one of the most generous people I have seen in my life, he would sacrifice anything for a good person when they need his help. He would stop his job and come and help when people need his help with a good heart... Whenever he get to know good things about someone he would always share the happiness with them...I still remember my father once told me he stayed with his father at the hospital for 3 months, he quite from his job and stayed at the hospital with his Dad to help him out... I'm sorry that I couldn't help you much.... but I promise I really wanted to do that...  I have never seen jealous feelings with my father. he always wanted to share the happiness with the people around him. He would advice people with a good heart and always be happy about it...Though my father couldn't be a financially stable person he had most of the good qualities one can have... I am always proud about you thaththa..... I really want to have all of them with me.... I promise I will try my best to help out people, like the way you did !!! His life wasn't an odd one which is just taking care of the wife and kids.. he always had his attention to his relatives, friends, neighbors.
   I know how much hard time he had because of his kids, how much he struggled to earn money for our studies, I have seen immense pressure man can have to raise his kids in my fathers eyes. I don't think I can forget the day that I failed grade 5 exam and at the same day he screwed up with my uncle and he came to me and said .. lets go back to his place and go to a school there....(It did not happen though).. I'm sorry thaththa that I did the test bad and made you unhappy..... But I am glad that I was able to make him happy almost all the exams I took after that ... I know you are always proud about your kids.... I promise you that I'll take care of everyone in our family on behalf of you... I know you knew that I'm gonna do that... I do remember the day I called you very last..... you were not good on that day .... I still hear your voice in my ears....You are always with me thaththa....!

    Seriously I still cannot believe this..... that I can't call my dad and ask something... get some advice.... Ohhh Seriously ... you left me alone ? I keep thinking about my dad every single day after he passed away... when I take the bus 6 or when I walk down to work or when I sit and write some code or when I do my workout... Still I am trying to live without you thaththa .... You know how much I love you, I'm still crying thaththa...even now I'm crying ... why did you do this.... ???? I'm sorry I hardly showed you how much I loved you ... You know I'm a big time hugger(only at home) but I hardly hugged you.  Today I regret that I didn't show my love to my father when he is alive... Please .. anyone who reads this .. if you love someone let them know that you love them when they are alive...Seriously I want you to come back ... but I know you are not gonna come back again.... You made me strong to live my life alone in this world.. I'm so proud of myself to be the son of you !!!! I want to be your son every time I born.. You are the best Dad ever ..... !!!!! Thaththa I love you so much !! 

Wednesday, January 11, 2012

How to reset IntelliJ idea settings in Mac

Recently I had difficulty working with Intellij Idea on MAC (MAC OS X verson 10.6.7) and I wanted to reset the complete setting of Idea and start from the beginning but without reinstalling Intellij Idea. It was very easy ..

Delete following directories and start Intellij Idea again and you will be asked to give the license key again and my issues got fixed when I reset the settings.

1. ~/Library/Caches/IntelliJIdea10
2. ~/Library/Preferences/IntelliJIdea10

I wanted to blog quickly before I forget.. Hope this helped !

Saturday, January 7, 2012

Its been six months since I started working in the US

Before writing anything about my life in US I should thank all the people who helped me to get this opportunity to work at Indiana University. I am sure I will always keep the fact that I got here with the help of bunch of awesome people back in Sri Lanka. I quit working at WSO2 in 2011 June and joined Indiana University to work in a Research Group as a Software Engineer. I think like my new job and its been six months I have been working in this Job. After I got here I couldn't write a single blog and I still don't know why I lost my motivation to write a technical blogs, but I hope I will write more technical blogs in future.

If I explain bit more about my job, I mainly working in a small research group which mainly focus on developing infrastructure for Scientist who are using Super Computers for their researches. I learned initial concepts of science gateways and currently I am working in an Apache project called Airavata. I hope to write few more blogs about Airavata in coming few weeks.

The town I am living, is one of the most peaceful places I have seen ... there's very less traffic less people less noise.. and very less people in busses compare to Sri Lanka. I simply like this environment.. Last few months I was only doing my job and next important thing I have done was going to gym which I am happy about. But I still believe that I need to go back to my country where I belong and live there with my family and friends. I just wanted to explain the good things I have seen here :) I've spent a very slow and peaceful life compare to how I was living in Sri Lanka, but sometimes I feel like thats not the best way to live the life. One main challenge I had after coming here is doing my things by myself. When was an undergrad I could't learn how to live by myself, I used to bring up the cloths every weekend and my parents used to wash them for me.. But here I had to cook my food, wash my cloths (its not hard as my mother or father washing them by hand) and clean my room etc. I learned how to cook Sri Lankan food and my cooking is getting better and I was able to manage live by myself which I am proud of. I practically understood how hard my moms life during last 20-25 years and thanks mom of raising me up to this level so that I can do my stuff by myself.

In General I believe I am doing great at this point and I have to get the maximum use of my time I am spending in United States. I am thankful to everyone who helped me to get here and helped me during my stay in Bloomington. I hope to write more useful blogs than writing about my life !!!

Sunday, June 12, 2011

Ubuntu Sound System Restart

I used to have some issues when I go to standby mode time to time and use continuously few days. Sometimes I my sound system is not working, I just here small annoying sound when I try to play a song. But following steps helped me to restart the sound program.

Go to : System -> Preferences -> Sounds -> Hardware

There you will see your device selected and down you will see a dropdown to select profile. In the profile list there is one option of "Off", select it and again select the previous value you had.... These steps fixed my issue .
I just wrote a quick blog post before I forget the steps !!!

Wednesday, May 11, 2011

Monitor WSO2 Servers with Wireshark

I recently had to look in to how to use Wireshark to monitor the traffic between set of WSO2 products, I found some useful configuration steps which was bit difficult to find in a single place in internet. We had a requirement of monitoring all the HTTP traffic and we wanted to monitor complete payload even though some of the transactions were HTTPS, so I will be describing how to configure Wireshark for a scenario like this. Since I was new to Wireshark I found the initial instructions were not very clear to start using Wireshark, so that is one of another motivation for writing this blog post. This blog post will be a very quick one which doesn't contains any screenshots, I hope to write a detail one but I need to write this before I forget these steps...

My Environment is Ubuntu so when you install it using Ubuntu Software Center you will get a package which is compiled with GnuTLS so to monitor HTTPS traffic you don't have to compile Wireshark again. If you are on Non-Unix system you have to compile it with GnuTLS (there are plenty of documentation on how to do this).

I assume you have a service running on WSO2 WSAS which is secured and you have a client to invoke that Service, and you have another client invoke another unsecured Service in WSAS, with this setup you can monitor HTTP and HTTPS traffic goes to both services.

  1. Start Wireshark and see whether you see set of Interfaces where you can monitor, if you do not see any interface, it's because you do not have enough rights to monitor any of the interfaces. So please start as a root/sudo mode if you did not see any interface.
  2. Now go to Edit -> Preferences -> Protocols -> HTTP there you will see two entries like "TCP/Ports" and "SSL/Ports". Add your Servers (WSO2 WSAS) HTTP port in to TCP/Ports list with a comma if you have number of ports to configure in a scenario where you want to monitor traffic among few hops add them as comma separated values. (Ex: HTTP - 9763).
  3. Now add your server HTTPS port in to SSL/Ports entry, by default it's having 443 to monitor browser HTTPS traffic (Ex:, HTTPS - 9443).
  4. Now you are in a position to monitor the traffic goes to WSAS by applying http filter. But you will not see the encrypted messages going to the Secured Service. To decrypt the messages which goes to WSAS you need to export the private key of the server (WSO2 WSAS). To do that you can use a simple tool like Keytool IUI[2].
  5. Download the keytool IUI [2], extract it and run the script (I got some errors in the tool when I was trying to run the shell script, so if you get the same just run the following command). $JAVA_HOME/bin/java -Xms128m -Xmx196m -jar rc15ktl.jar
  6. This will open the Keytool and go to Export -> KeyStores Entry -> Private Key There you will see four fields to be filled. Now what we are going to do is simply get the private key of the WSO2 WSAS in unencrypted format and add that in to Wireshark which will help to decrypt the messages.
  7. Give the keystore file path which is WSAS_HOME/resources/security/wso2carbon.jks, and the password will be wso2carbon, The add private Key and Certificate Chain file locations to the place where you want to store the private key. And make sure you put the file type as PEM in last two fields.
  8. After pressing OK you will ask to select the select Keypair trust among a list, select the entry you have "wso2carbon" as the alias. Lets assume the output private key file path is /home/lahiru/client/fhlb/wso2is-3.0.1/resources/security/private.pem.
  9. Now you have have the private key of the server in unencrypted format, now go to Edit -> Preferences -> Protocols -> SSL there you will see a field (empty) RSA Key list for that add the following entry. 127.0.0.1,9443,http,/home/lahiru/client/fhlb/wso2is-3.0.1/resources/security/private.pem ,,,private-key-path-of-the-server
  10. Since we are going to monitor traffic in the same machine we are selecting the interface 127.0.0.1 (If your operation system is Windows things will not work out of the box with loop-back address so for window users please refer this[1]). To select the interface go to Capture -> Interfaces there you will see 127.0.0.1 press the start button in 127.0.0.1 interface.
  11. Now you can send two messages to secure and un-secure services then after you get the responses go to Wireshark and add Filter (from the top field with the name filters) http.
  12. Now ideally you should see four entries, request-response messages for two transactions and you will be able to view the content of the secure request-response messages too.
Please refer[3] for further detail about how to decrypt the messages using Wireshark.

Friday, March 4, 2011

A Great mahindian sets down


Even though I thought of writing a blog post about Monath ayya who left us few days back I am not in a good position to have creative ideas, I have been thinking about him hundred times last few days. For me accepting he left us is really painful. I am sorry that I couldn't make it to Monath ayyas funeral because I am out of the country but no matter where we are you are always at the bottom of our hearts.

I remember the way we played cricket in Sangamitta ground, the way we went to school together long time back and the time I met you during last Mahinda Night in April you were still Monath ayya .... the humble simple man. From the school days Monath ayya was a genius who were there in our school and he was a model which we always used to talk as a senior student. He was the active guy and he was the actor and he was the best English Literature expert and He was the College western band Leader. There was a math class we all used to go (Mrs Gange) and I still remember he used to be given gifts from the teacher for getting 100 marks for the exams.
During the time we had the war we were very strong as Mahindians because we all knew that you are a hero in Air Force, we never needed any one else. We were proud about you when we heard that you were the best flying officer, we were proud about you when we see your name in the paper and we were proud to see your pictures with Kafirs but finally we were not lucky to be with you. You are always our pride Monath ayya...
Simply it was like my brother is fighting in the war and I believe it's same for any mahindian. We are always greatful to you the job you have done for sake all of us. You stayed little time with us and did amazing thing for us and you left us. Still I cannot imaging that I won't be able to see you or talk to you again... though this is quit painful I am personally trying to accept the fact that we lost you ... We all love you Monath ayya ... you are the unforgettable Mahindian in our time. We all proud of you... I am sorry again that I couldn't pay my respect to you but I will make sure I will do my job for you according to our religion....

Rest in Peace Monath ayya .... You are a great Mahindian ... you are a great Hero .... You are a great Sri Lankan you are the Humble good man we always call Monath ayya ...our pride !