I generated a new Torquebox Rails app and copied my app into the hierarchy. I did a bundle install after all gems were added to the Gemfile and now it looks like webrick pukes when attempting to load the mysql driver: ActiveRecord::JDBCError: The driver encountered an unknown error: cannot load Java class com.mysql.jdbc.Driver initialize at /home/jim/bin/torquebox-2.2.0/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-126.96.36.199/lib/arjdbc/jdbc/connection.rb:91 initialize at /home/jim/bin/torquebox-2.2.0/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-188.8.131.52/lib/arjdbc/jdbc/adapter.rb:33 initialize at /home/jim/bin/torquebox-2.2.0/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-184.108.40.206/lib/arjdbc/mysql/adapter.rb:465 jdbc_connection at /home/jim/bin/torquebox-2.2.0/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-220.127.116.11/lib/arjdbc/jdbc/connection_methods.rb:6 mysql_connection at /home/jim/bin/torquebox-2.2.0/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-18.104.22.168/lib/arjdbc/mysql/connection_methods.rb:19 __send__ at org/jruby/RubyBasicObject.java:1665 send at org/jruby/RubyKernel.java:2090 I am loading: gem 'activerecord-jdbc-adapter' gem 'activerecord-jdbcmysql-adapter' in my Gemfile. I'm using the JRuby from the Torquebox install as my default system Ruby. (well, JRuby actually, I nuked RVM so now I need to type "jruby -S" before all my commands) Is anyone else using MySQL with the latest JRuby, Rails and Torquebox? Anyone else got it working? -Jim
on 2012-12-29 17:22
on 2012-12-29 19:35
Interesting problem I created a new Rails app that used MySQL and the gems you used, and when I tried to run rails console, I got the same error that you did. I looked into the gem's directory tree for the JDBC jar file, set the classpath to include it, and then it worked: >CLASSPATH=/Users/keithb/.rvm/gems/jruby-1.7.1/gems/jdbc-mysql-5.1.22/lib/mysql-connector-java-5.1.22.jar rails console Loading development environment (Rails 3.2.9) jruby-1.7.1 :001 > I realize this shouldn't be necessary, but it may be a step in the right direction. Having the gem in the Gemfile makes it available to the application, but what actually loads (or requires) it at runtime? Maybe answering this question would lead us to the solution. I guess until we figure it out, you could just do the same CLASSPATH hack and it might work. - Keith --- Keith R. Bennett http://about.me/keithrbennett
on 2012-12-29 21:04
Putting gem 'jdbc-mysql', '5.1.13' in your Gemfile should fix the error. The issue is because of an incompatibility between the new jdbc-* gems and the version of activerecord-jdbc-adapter that is out. You can find more discussion about the issue here: https://github.com/jruby/activerecord-jdbc-adapter/pull/284
on 2012-12-29 21:33
Confirmed, this worked for me. Thanks! This seems like a significant problem that could discourage JRuby adoption and make JRubyists less productive. What's up with this incompatibility? Is it a challenging issue, technically? Or are the authors/contributors too busy with other things? I don't mean to be critical, I know I'm not contributing to the solution, but I'm curious. - Keith --- Keith R. Bennett http://about.me/keithrbennett
on 2012-12-29 21:36
At this point the issue is well understood and we're just waiting for someone to yank the incompatible gems and to merge the fix.
on 2012-12-29 21:44
If you're new to JRuby adoption, I gotta tell ya... this is kinda par for the course. I don't mean to sound discouraging at all as I feel we have some of the smartest minds working on the issues, and I LOVE working with this stack. But, I also think there are so many plates spinning in the air, that the JRuby developers alone can't truly address all the issues. We have the JVM which runs JRuby, which runs Rails... which uses myriad gems to accomplish many different goals. I do feel the same way every time I go to update to some newer version and get "Ruby Vomit" all over my console. There is a part of me that says, "Can't it just work... just once? Do I have to fight it every time??? Could it be more like other stacks that just seem to work???" It'll get better... but we need to remember that we're working with an amazing "work in progress". Cheers to the people that make it happen!
on 2012-12-29 21:44
Alex Tambellini wrote in post #1090606: > Putting gem 'jdbc-mysql', '5.1.13' in your Gemfile should fix the error. > The issue is because of an incompatibility between the new jdbc-* gems > and the version of activerecord-jdbc-adapter that is out. You can find > more discussion about the issue here: > https://github.com/jruby/activerecord-jdbc-adapter/pull/284 Thanks, this got me past the error. Now to fight the others.
on 2013-02-01 05:05
Alex - Do you know what the status of this is? I did a little research but am still a bit confused. Thanks, Keith
on 2013-02-01 06:14
Using version 1.2.5 or greater of activerecord-jdbc-adapter should fix this issue.
on 2013-02-01 06:16
Alex Tambellini wrote in post #1094675: > Using version 1.2.5 or greater of activerecord-jdbc-adapter should fix > this issue. Unfortunately, this problem still persists. I've locked my gem version at 22.214.171.124 (the last working version)
on 2013-02-01 15:29
1.2.6 just came out yesterday but ruby gems is down for some reason ugh, I'll try it again when I can update
on 2013-02-01 15:37
The recently TorqueBox 2.3.0 ships with distributed transaction support disabled by default for databases which should get things working again with ActiveRecord-JDBC 1.2.5. If you're on an older version of TorqueBox, try adding 'xa: false' to your database.yml entry and things should work on AR-JDBC 1.2.5. Ben