ruby-on-railsruby-on-rails-4bundlerjrubyjrubyonrails

bundle install hangs in Jruby with rails 4.2


I am running on a standard Digital Ocean Ubuntu 14.04 droplet.

I installed my rails app with rails 4.2.0.beta4 and did my first bundle install with mri ruby 2.1.4 installed via RVM and using a gemset I called r420. After making some minor edits to the rails app I then installed jruby 1.7.16.1 and set up a gemset called j420 and then attempted to run a bundle install. Each time I attempt to run a bundle install with jruby the bundler hangs, producing no error. I tried defining the ruby dependency as advised by heroku in the Gemfile by adding the line "ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.16.1'". This also hangs.

I saw in another entry on this site that someone suggested in an earlier version of rails that one might change the source to ':rubygems'. This only resulted in an error message saying that no such domain exists.

Otherwise my app works fine in MRI, but I really want to get jRuby working if possible. I am interested in producing a thread safe rails app of course.


Solution

  • first of all "minor-changes" might not be enough for switching Rails (esp. ActiveRecord) ... the C drivers use the MRI API which is not supported in JRuby, you need to setup the JDBC adapter which does the same using "native" Java APIs e.g. for MySQL :

    gem 'mysql2', platform: :mri
    gem 'jdbc-mysql', platform: :jruby
    gem 'activerecord-jdbc-adapter', platform: :jruby
    

    NOTE: as of the time of this answer Rails 4.2 is not supported with AR-JDBC (they did a lot of internal AR refactorings that might take a while to finish up)