Enforce JRuby to use gems inside the JRuby complete and ignore the local gem repository

Most of us are aware that Gems can be bundled as part of JRuby Complete, and Jruby will automatically load these gems from the jruby-complete.jar happily.

But do you know that, if you had a local gem repository set, jruby will ALWAYS attempt load the gems ONLY from your local gem repository? And ignore the gems bundled inside the jruby-complete.jar?

Well, we are aware of that, but it was quite annoying when we find that some code that worked happily in our development environment does not work in production, bcos the codes were referring to some gems that were available only in our development environment.

To ensure JRuby completes ignores our local gem repository, we used to add the following line in our deployment scripts before launching JRuby.

unset GEM_HOME

We are trying to understand the principle behind using the local gem repository even though certain gems are bundled inside the Jruby Complete.

Some thoughts on how Jruby should choose the gem repository
1. Whenever jruby is launched from the jar file with embedded ruby home, then always assume to use the embedded gem home and ignore the local gem repository?


2. If atleast one gem is bundled in jruby-complete, then can jruby assume the developer wants to use the particular gem in his application and hence ignore the local gem repo and set the gem repo as the embedded gems location inside jar?

We are unable to come to a conclusion on what is the sane approach to handle the situation.

For now, we have patched jruby to go thru first approach. This way, I am completely sure that when jruby is launched from jar, my local gem repository is not coming in the way. And I dont have to remember to “unset GEM_HOME” in all my deployment scripts to tell Jruby to look for gems embedded in the jar file.

Hope this may be of some help for people who have had faced this issue.

Posted in gems, jruby, programming, technology | Leave a comment

JOpenSSL gem inside JRuby Complete

We had faced quite a lot of issues trying to embed JOpenSSL inside jruby-complete.jar.

We used to get an error “Uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER” with the following stack trace :

NameError: uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl/cipher.rb:28:in `const_missing’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl/digest.rb:23
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl/digest.rb:31:in `require’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl.rb:24
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl.rb:31:in `require’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’

You can find Charles’ explanation here

What we did is the following :

1. Add the Jruby-openssl gem inside the jruby-complete.jar bundle like adding any other gems(rspec, rake etc.)
2. Extract the JRuby Complete Jar in a fresh folder
3. In addition to this, extract the contents of jopenssl.jar directly under the root folder. (jopenssl.jar is located inside the lib folder of the jruby-openssl gem).
4. Re-create the jruby-complete.jar from this exploded folder.

Thats about it, you are all set to use openssl inside jruby without any issue.

Please note, at the time of writing this post, I was using JRuby 1.3.1 and Jopenssl 0.6.

Posted in jruby, openssl, programming, technology | Leave a comment

Another iPhone App on the pipeline – Tarabalam

After developing an iPhone app called Panchangam Lite and seeing its success rate in terms of increasing number of downloads day after day and receiving positive feedback for the app, we were motivated quite a lot and it made us realize that there are lots of people around the world looking for such cool and useful tools in their iPhone…And we thought lets develop another app for such people in the similar lines…hence an app named “Perfect Day (Tarabalam)” is born.  The app should be available in AppStore very soon 🙂

Ok, then here goes some notes about “What is Tarabalam ?” and why and how should it be used?


Importance of Muhurtha (Quoted from the well known astrologer BV Raman)

The value of Time is inestimable. All objects in nature are produced in Time, developed in Time and destroyed in Time. The truth of these statements requires no further proof. It stands unchallenged.

Each moment has got its own potency and as Carl Jung says “whatever is born or done this moment of time has the qualities of this moment of time”. Hence the moment of birth or the moment at which we elect to do an important act is not certainly an insignificant epoch. Cosmic radiations pouring at the moment on the earth from outer space and coming from various stars and planets act on our brain cells which take up these cosmic radiations which are transformed into vital electricity. It must be noted that in all undertakings invisible energies are set in motion by our words, deeds, thoughts and of course by our actions. You may call these invisible forces as electric, ethereal or electro-magnetic or cosmic radiations. As man himself is an electrical body discharging different kinds of electrical energies, his success and failure are simply matters of attraction and repulsion between himself and the objects with which he has to deal in his day-to-day activities.

Muhurtha could therefore be defined as that precious moment when the vibrations radiated by man are altered to a specific wavelength capable of entering resonance with the radiations of the same vibratory rate coming from other planets and stars.

What is Tarabalam?

Various strengths are checked for muhurtham. Tarabalam, Chandrabalam, Gurubalam, Suryabalam, Lagnam shuddhi, etc… As outlined in following mantra. When we worship lakshmipati sri narayana, he will make everything right. He is tithi, vaara, nakshatra, yoga, karana. Hence, worshipping him will make everything right, remove all dosha.

तदेव लग्नं सुदिनं तदेव ताराबलं चंद्रबलं तदेव। विद्या बलं दैवबलं तदेव लक्ष्मीपतेः तेंघ्रिऽयुगं स्मरामि॥

tadeva lagnaṁ sudinaṁ tadeva tārābalaṁ caṁdrabalaṁ tadeva | vidyā balaṁ daivabalaṁ tadeva lakṣmīpateḥ teṁghri’yugaṁ smarāmi

Tarabalam is a strength provided by stars to your Janma / Birth star. Nakshatra/Star of moon at the time of your birth is known as Birth star. Moon’s daily star / Nakshatra position needs to be favourable for casting any muhurtha. Moon takes roughly 27 days to circle around earth and passes through 27 nakshatras. Daily motion of moon from your janma nakshatra decides this strength.

What does this mobile app do?

In order to increase the chances of success in any endeavor, this mobile app helps the user to pick days / times to perform the endeavor when Tarabalam is very strong. It calculates Tarabalam for 400 cities around the world for the year 2010. The timings are daylight adjusted where-ever applicable. You can also keep a list of your family / friends with their birth star and easily select Tarabalam for the person with just a click of the button.

Tarabalam is available for year 2010.

Posted in iphone tarabalam technology ruby rhodes | 1 Comment

Ruby Conference 2010 – Bangalore

Feels good to be part of the first Ruby Conference of India, which was held in Bangalore on 20th & 21st March, 2010.

And it feels all the more glad to see our company being one of the sponsors to this event. Having got so much from Ruby and the Open source world, this was a fantastic opportunity for us to give back something to the community.
Got to meet and spend time with some special people whom I was looking forward to meet for quite some time now. Got a chance to meet some of the top developers of the JRuby world – Ola Bini, Nick Sieger and not to mention Arun Gupta – lead developer of Glassfish.
Being one of the developers who have used the combination of Glassfish, JRuby and Rails in our enterprise applications, Arun Gupta captured a short little video about our experiences on working on this platform combination. Check out the video here.
The highlight of this event was the talk from the father of the Ruby Language Matz, who gave a wonderful talk via video conference from Japan. It was very special for Ruby developers like me.

Posted in http://schemas.google.com/blogger/2008/kind#post | Leave a comment

Getting MINA 2.0 to work peacefully in Glassfish

This weekend, I had some good opportunities to work on some cool things, one of which is build a Socket Server using Apache Mina 2.0(Release Candidate Version)…
Apparently, my project requires running two Socket Servers inside Glassfish v2, one to receive incoming client requests and the other as a simulator to receive what my application churns out.

I was happy to simply write a ServletContextListener which starts the Incoming Requests Socket Server in a separate Thread :). No Problems, I could connect to the Socket Server and communicate happily.

However, when I repeated the above steps to start the Simulator Socket Server(obviously listening in different port not conflicting with the previous Socket Server), server starts up fine. However, the minute I try to start communicating from a Socket Client to this Socket Server, the socket server started throwing a whole bunch of NullPointerException in NioSocketAcceptor.accept() method.

Why did this behavior not happen when I was running my first Socket Server but only happens with my second Socket Server. As usual Google came to my rescue at the wee hours too 😉

I was told to add the following property to my Glassfish JVM


Check this forum thread that helped me. Apparently this seems to be a bug in Glassfish v2 and has been fixed in V3. For Glassfish v2, the above property should help.

Glassfish Bug Database links related to this issue
Bug Id 3027
Bug Id 5321
I am still unable to understand why I did not have this problem when running first Socket Server inside Glassfish!!! One of those questions that still remains unanswered !

Posted in glassfish mina | Leave a comment

Glassfish Clustering – NullPointerException while creating JMS RA

Didn’t I tell you that we had an exciting experience enabling cluster support for our applications using Glassfish.

Even though the entire setup worked fine in our local environment, life was not the same when trying to deploy our application on Amazon EC2 Cloud. We were greedy enough to pick a large machine with 8GB RAM and quad-core processors…and attempted to deploy our applications on the Glassfish Cluster there…
Our Server Instances would never start, failing with a whole bunch of NullPointerExceptions while creating JMS RA. I gave up after googling for couple of hours. And as usual, Venkat came to my rescue. He took over from me and spent some midnight oil and figured out the trick…
We had to add an unsupported property to the JVM…


Check out this link from Ramesh Parthasarathy for more useful information related to this issue
Posted in Uncategorized | Leave a comment

Glassfish v2.1.1 Cluster Session Replication inconsistent behavior

Everytime I take up a task on adding Cluster Support to my j2ee application, the whole experience gets quite exciting with new kinds of challenges 🙂

In the past, it was with Weblogic, Websphere etc…and this time it was Glassfish 🙂
Ok, like many of you, I managed to setup the cluster environment in glassfish and deployed “ClusterJsp” application to check out Session Failover, Load balancing etc…
What I found was that, if I keep refreshing the ClusterJsp page 5 to 10 times, my Session Id keeps changing…going to say that Glassfish lost my session somewhere in between these requests.
After googling and bing’ing a lots, I managed to find this link, which explained the issue in detail.
Basically, we should add the following snippet in sun-web.xml
After adding the above entry, Glassfish started behaving as expected.
Now what I donot quite understand is, why was this behavior not made a default behavior !!!
I am sure there is a good reason for it, will update If I get to know.
Posted in Uncategorized | 3 Comments

Our First iPhone App

After being an user of iPhone for past one year, we got inspired to write an app for iPhone 🙂

We were thinking if we should write a simple Game or Puzzle Application, and then came this idea of publishing a Panchangam data for 2010. Venkat came up with the data for all the days for year 2010 and we put together an application called “Panchangam Lite 2010”. The reason for this “Lite” is the fact that this Panchangam provides data (timings) specific to Bangalore. We have plans to make a Panchangam Pro (?!) which allows you to choose the city and lookup the panchangam data…and even further, automatically figure out the location of the iPhone using the “Location service” of iPhone.

And guess what, within 5 days of our launch of this app, we have found more than 300 downloads of this application. We are all the more motivated to come out with more such useful apps in the near future 🙂

Want to check out countries from where our app was downloaded till date…go to Venkat’s blog post here

Posted in Uncategorized | Leave a comment

Glassfish v2 Create Domain – Keytool Error:java.io.EOFException

Yesterday night, I had to work on some interesting stuff with my application’s deployment tool. We have a Ruby RakeFile to automatically create glassfish domain and deploy apps. As I was running the tool creating domains atleast 10 times or so, suddenly at one stage I got an error while creating glassfish domain…the error was “keytool error: java.io.EOFException”. I thought some evil spirits has got into my laptop at the wee hours…hence gave up and went off to sleep.

Today morning, I thought let me give this a fresh look…
And I learnt that you can turn on debug logging by adding -DDebug in the asadmin script. This helped me to say that there is something wrong with a keystore that Glassfish was looking for while creating the domain.

After couple of rounds of googling, I realized that the keystore is stored in my home folder with the name .asadmintruststore. Apparently the file size was just 1 byte. I just deleted the file and now the creation of domain went thru fine 🙂

On thinking what could have corrupted the keystore, I realized once when the creation of domain was going thru, I had abruptly killed the operation by Ctrl+C, which could possibly have corrupted the keystore!

Hope this helps someone who bumps on this issue 🙂

Moral of the story : Dont try to stay late and work…sleep early 🙂

Posted in Uncategorized | 3 Comments

Ubuntu : On Hibernate , machine restarts

Uff! I have been trying to get Hibernate (Suspend-to-disk) option work properly with Ubuntu in my home PC, versions after versions, starting from Dapper Drake (v6.04) to the recent Karmic Koala(v9.10).

Even though the actual hibernation(meaning, dumping the memory content into the Swap partition of my disk) happens fine, my machine suddenly restarts within 3 seconds after a complete halt. I have been going crazy to even figure out the sentence to help google find what I am looking for from the net.

Finally, at 9:45pm with half sleepy eyes, I managed to find some help after going thru lines and lines of posts from various forums…that I had to add a file to my /etc/pm/conf.d and add the following line to the file


the hibernation happens properly and my machine goes to sleep happily thereafter 🙂
Thanks to this post
PS: Folks, also please ensure that you specify where your hibernate file is present to Grub to ensure it wakes up instead of booting afresh. You have to add resume=/dev/sda5(swap partition). But I also noticed recently in my dad’s netbook, without this resume option, GRUB properly wakes up from Hibernation. God knows how!…Something to research on sometime later….Will post my findings if any 🙂

Posted in Uncategorized | Leave a comment