Struggling with Jruby Rails + jdbc driver

Now this is cheating. I finally decided to add the derbyclient.jar from the maven repo to my CLASSPATH env var in my bash profile. Which get things going for now. However, I am still baffled at what made it all work before I did the whole MacPort & RVM reinstall routine as my bash_profile hasn’t been touched for quite some time already. Which only means things was working without adding anything to the CLASSPATH.

I said my work around is cheating since the whole Gem + bundle + Gemfile should have made the rail app kinda self contained and shouldn’t rely on external setting like CLASSPATH? Please correct me if I am wrong.

Anybody have similar experience?



I give up. But found a better workaround and that might just actually be what I have done in the first place to get it working.

Turns out the jdbc-derby gem doesn’t have the derbyclient network driver but only the embedded driver. Thus the class not found. I tried many things and thinking some combinations of the gems that I added trying to get it work corrupted something. But still no dice. I ended up cleaning out the jruby again from RVM. And then go on to manually removing the corresponding gem directory (.rvm/gems).

One thing I encountered amid the removal and reinstall was getting the following err when trying to run bundle command:

…ruby_noexec_wrapper:7:in `require’: no such file to load…

Solution was to set the default ruby again from rvm with the “–default” option.

And finally the workaround is… just stick the derbyclient driver in the “.rvm/rubies/jruby-1.7.2/lib” directory and that loaded automatically and I don’t have problem with intellij anymore that way.

If anyone knows how to solve this more elegantly, please let me know. My gut feeling tells me it might involve a new gem or something, which I don’t know how to make yet.

*Joseph *

That sir, is caused by rubygems-bundler in @global.

Thank you Jordon, for the extra info. I have not yet master enough knowledge of how rvm works yet. I just know enough commands to monkey it around til it works. :> Guess a visit to the rvm / bundler page will be needed soon.