Saturday, September 1, 2007

JRuby/Rails on Glassfish Actually Works!

So traffic was so bad on Thursday I popped open my Powerbook on the Edens spur (I swear it took me an hour to go 3 miles) and listened to Java Posse 138 which had a lengthy (but quite excellent interview with several Sun developers from Glassfish. Java Posse is an excellent podcast. I wish there was something of comparable quality on Ruby, but no time for that rant.

Besides the performance improvements (indeed the startup time is quite amazing compared to JBOSS, Geronimo, or Sun's appserver) they mentioned running JRuby apps and I ran across this blog entry on running interpreted rails apps within Glassfish v3 and the Grizzly connector.

I had to make few changes to get it working to Linux-ify the tutorial (had to create a symlink within glassfish/lib to point to the jruby directory) but it was relatively straightforward on Debian 4.0, (JRuby 1.0.1 and jdk1.6.0_02)

Here the slight differences:

I set the environment variables in .bashrc


Install rails (added --no-ri)

# jruby -S gem install rails -y --no-ri --no-rdoc

Modify glassfish/config/asenv.conf instead of asenv.bat


Make asadmin exectuable (chmod u+x/700)


Arun Gupta said...

Thanks for trying out the steps. Can you please post the changes as comments to the original blog ?


Pramod Gopinath said...

I have pushed out a new version of the glassfish V4 JRuby gem on RubyForge. You could download the gem by running the command 'gem install glassfish' from your JRuby installation. For the gem to run in the JRuby environment you do not need to add a JRUBY_HOME environment variable to be set in the asenv.conf file.
Further details can be obtained from my blog entries latest being :