hi all,
I am having a hard time trying to find out what’s wrong with my setup.
It
used to work smoothly until I decided out of the blue to do a selfupdate
and upgrade outdated on MacPort, then things started going south very
quickily.
Since MacPort kinda broke, I pull it all out and re-install the ports I
have before, which went pretty smoothly. Then to my surprise any command
I
issue like ruby, gem /bundle started giving me “execv failed: Permission
denied (13)” error. Not much luck googling that. So after couple hours,
I
pulled the whole thing as well. Remove all rubies from RVM and then
re-installing them.
I got to a point where the ruby, gem, bundle functions without problem.
Now
firing up my test project it can no longer connect to the derby database
anymore. I tried manually adding the jdbc-derby in the gem file even
thought I know “activerecord-jdbcderby-adapter” should have that as
dependency. But it is still giving me class not found error. Suspecting
I
might have screwed my current project setting somehow, I created a brand
new app and added the same derby active record adaptor and jdbc-derby
gem
in the gem file. Unfortunately I am still having the same problem listed
later in this post.
Coming from the Java world, the classpath thing is pretty easy to follow
even with maven. However I am totally scratching my head on how jruby &
rails finds and loads the java lib and I can’t seem to find any clear
info
on that. I can see the Any pointers on how to solve my problem and
might
be potential place where I should look shall be greatly appreciated!!!
I can see the jdbc-derby gem installed under my .rvm dir but have no
idea
how it gets loaded at runtime in jruby and rails:
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/lib
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/lib/derby-10.8.3.0.jar
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/lib/jdbc
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/lib/jdbc/derby.rb
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/LICENSE.txt
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/Rakefile
./gems/jruby-1.7.2/gems/jdbc-derby-10.8.3.0/README.md
Error I am getting:
hello01 $ rails console
Loading development environment (Rails 3.2.12)
irb(main):001:0> User.all
NameError: cannot load Java class org.apache.derby.jdbc.ClientDriver
from org/jruby/javasupport/JavaClass.java:1227:in for_name' from org/jruby/javasupport/JavaUtilities.java:34:inget_proxy_class’
from
file:/Users/josephli/.rvm/rubies/jruby-1.7.2/lib/jruby.jar!/jruby/java/core_ext/object.rb:26:in
java_import' from org/jruby/RubyArray.java:2361:inmap’
from
file:/Users/josephli/.rvm/rubies/jruby-1.7.2/lib/jruby.jar!/jruby/java/core_ext/object.rb:22:in
java_import' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/driver.rb:24:indriver_class’
from org/jruby/RubyModule.java:2291:in module_eval' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/driver.rb:23:indriver_class’
from org/jruby/javasupport/JavaObject.java:272:in synchronized' from org/jruby/javasupport/JavaProxyMethods.java:90:insynchronized’
from
/Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/driver.rb:20:in
driver_class' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/driver.rb:8:ininitialize’
from
/Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/connection.rb:44:in
configure_jdbc' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/connection.rb:24:inconfigure_connection’
from
/Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/connection.rb:82:in
initialize' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-jdbc-adapter-1.2.7/lib/arjdbc/jdbc/adapter.rb:31:ininitialize’
… 20 levels…
from
/Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-3.2.12/lib/active_record/relation.rb:160:in
to_a' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-3.2.12/lib/active_record/explain.rb:33:inlogging_query_plan’
from
/Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-3.2.12/lib/active_record/relation.rb:159:in
to_a' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:159:inall’
from org/jruby/RubyBasicObject.java:1659:in __send__' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/activerecord-3.2.12/lib/active_record/querying.rb:5:inall’
from (irb):1:in evaluate' from org/jruby/RubyKernel.java:1066:ineval’
from org/jruby/RubyKernel.java:1392:in loop' from org/jruby/RubyKernel.java:1174:incatch’
from org/jruby/RubyKernel.java:1174:in catch' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/railties-3.2.12/lib/rails/commands/console.rb:47:instart’
from
/Users/josephli/.rvm/gems/jruby-1.7.2/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in
start' from /Users/josephli/.rvm/gems/jruby-1.7.2/gems/railties-3.2.12/lib/rails/commands.rb:41:in(root)’
from org/jruby/RubyKernel.java:1027:in require' from script/rails:6:in(root)'irb(main):002:0>
Any help would be appreciated,
Joseph