JRuby, Rails, JBoss, and Jfrustration – Fixing Warble 0.9.4’s Standard Includes
Work has been busy. Scratch that work has been absolutely insane and confusing and at times, baffeling, but I have to say that I wouldn’t trade the experience for the world! On the bright side, I’ve been distracted during what were the two worst weeks for the Brewer’s season (right now they are beating-up on Houston). Now that I have some time to myself I have had dinner w/ the Mrs., read some of the Bourne Identity, and have gotten back to porting my Ruby On Rails Knowledge Base application to JRuby on Rails on JBoss. The past few sessions I’ve spent with the technology have been plagued with the error message:
2009-08-16 00:27:28,101 ERROR [STDERR] (main) Warning: JRuby home "/home/sam/usr/jboss-5.1.0.GA/server/default/deploy/railskb.war/WEB-INF/lib/jruby-complete-1.3.0RC1.jar/META-INF/jruby.home" does not exist, using /tmp
2009-08-16 00:27:28,507 ERROR [STDERR] (main) Rails requires RubyGems >= . Please install RubyGems and try again: http://rubygems.rubyforge.org
2009-08-16 00:27:28,512 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/railskb]] (main) unable to create shared application instance org.jruby.rack.RackInitializationException: exit
from /home/sam/usr/jboss-5.1.0.GA/server/default/tmp/3j001-au64oi-fyfc3ruh-1-fyfc4xzj-9p/railskb.war/WEB-INF/config/boot.rb:38:in `run'
from /home/sam/usr/jboss-5.1.0.GA/server/default/deploy/railskb.war/WEB-INF/lib/jruby-rack-0.9.4.jar/jruby/rack/rails_boot.rb:20:in `run'
from /home/sam/usr/jboss-5.1.0.GA/server/default/tmp/3j001-au64oi-fyfc3ruh-1-fyfc4xzj-9p/railskb.war/WEB-INF/config/boot.rb:11:in `boot!'
from /home/sam/usr/jboss-5.1.0.GA/server/default/tmp/3j001-au64oi-fyfc3ruh-1-fyfc4xzj-9p/railskb.war/WEB-INF/config/boot.rb:109
from /home/sam/usr/jboss-5.1.0.GA/server/default/tmp/3j001-au64oi-fyfc3ruh-1-fyfc4xzj-9p/railskb.war/WEB-INF/config/boot.rb:20:in `require'
from /home/sam/usr/jboss-5.1.0.GA/server/default/tmp/3j001-au64oi-fyfc3ruh-1-fyfc4xzj-9p/railskb.war/WEB-INF/config/environment.rb:20
Notice the odd line “Rails requires RubyGems >= .”. Eh? I did a log of digging in google and found about 4 sets of forum posts that identify this problem and correlate it with an upgrade to Rack 0.9.4 from 0.9.3. I also noticed that Warbler had included in it a copy of jruby-complete-1.3.0RC1.jar and jruby-rack-0.9.4.jar when the version I would like it to use is jruby 1.3.1.
After a little failed convincing and JBoss continually showing that while it had included in it jruby 1.3.1 that it was choosing to use, and fail to find the ruby gems, on the 1.3.0RC1 jruby jar mentioned in the log above.
Finally, I bit the bullet and decided to punt on Warbler’s automagically included jars and manually include. To do this I:
- created
lib/javain my rails application directory. - copied into it
jruby-complete-1.3.1.jar - copied into it
jruby-rack-0.9.jar - add the line
config.java_libs = FileList["lib/java/*.jar"]toconf/warble.rb
Loading this into JBoss the application loads! When I access it, it explodes in another fashion, but that’s fine! I’m still learning and I’m past my deployment problems for now!