Newbie: Rack Error Running a Current Rails App on JRuby

So - just to test out JRuby, I wanted to get a current rails app we have
simply running - and play with the Java bits later. Instead of going
deep into Glassfish and Bundlers - I’m assuming I can just start up my
current app with jruby script/server.

I get the following error:

Gem::LoadError: Could not find rack (~> 1.0.0) amongst [rack-1.3.2,
rake-0.8.7, rubygems-update-1.8.6, sources-0.0.1]
to_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247
to_spec at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256
gem at /opt/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1195
(root) at
/Users/krishdasgupta/projects/testapp2/vendor/rails/actionpack/lib/action_controller.rb:34
require at org/jruby/RubyKernel.java:1038
require at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
require at
/Users/krishdasgupta/projects/testapp2/vendor/rails/actionpack/lib/action_controller.rb:156
new_constants_in at
/Users/krishdasgupta/projects/testapp2/vendor/rails/activesupport/lib/active_support/dependencies.rb:521
require at
/Users/krishdasgupta/projects/testapp2/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
(root) at
/Users/krishdasgupta/projects/testapp2/vendor/rails/railties/lib/commands/server.rb:2
require at org/jruby/RubyKernel.java:1038
require at
/Users/krishdasgupta/projects/testapp2/vendor/rails/railties/lib/commands/server.rb:36
(root) at script/server:3

Now, when I do switch the Rack version to 1.0.0 - I get the following
error:

=> Booting WEBrick
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
NoMethodError: undefined method `name’ for “rack”:String
== at
/Users/krishdasgupta/projects/testapp2/vendor/rails/railties/lib/rails/gem_dependency.rb:268
=== at org/jruby/RubyKernel.java:1862
matching_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217
each at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410
each at org/jruby/RubyArray.java:1603
each at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:409
find_all at org/jruby/RubyEnumerable.java:673
matching_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216
to_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238
to_spec at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256
gem at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1195
add_load_paths at
/Users/krishdasgupta/projects/testapp2/vendor/rails/railties/lib/rails/gem_dependency.rb:73
add_gem_load_paths at
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:301
each at org/jruby/RubyArray.java:1603
add_gem_load_paths at
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:301
process at
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:132
send at org/jruby/RubyKernel.java:2092
run at
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:113
(root) at
/Users/krishdasgupta/projects/testapp2/config/environment.rb:11
require at org/jruby/RubyKernel.java:1038
require at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
require at
/Users/krishdasgupta/projects/testapp2/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
new_constants_in at
/Users/krishdasgupta/projects/testapp2/vendor/rails/activesupport/lib/active_support/dependencies.rb:521
new_constants_in at
/Users/krishdasgupta/projects/testapp2/vendor/rails/activesupport/lib/active_support/dependencies.rb:520
require at
/Users/krishdasgupta/projects/testapp2/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
(root) at
/Users/krishdasgupta/projects/testapp2/config/environment.rb:84
require at org/jruby/RubyKernel.java:1038
require at
/Users/krishdasgupta/projects/testapp2/vendor/rails/railties/lib/commands/server.rb:36
(root) at script/server:3

Any thoughts? Thanks for helping out or offering simple tips to get my
feet wet. We have java processes that typically run to do data
processing, I was playing with the thought of triggering and having that
data available to our rails apps real time and notified as opposed to
through the DB.

Thanks!

Still wondering about a solution if anyone has thoughts on this - or is
there a more active JRuby Forum? Thanks again!

Try using the jruby-rack gem if you aren’t already.

I installed the jruby-rack gem - I get this error:

Gem::SourceIndex#add_spec called from
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
Gem::LoadError: Could not find rack (~> 1.0.0) amongst
[jruby-rack-1.0.9, rack-1.3.2, rake-0.8.7, rubygems-update-1.8.6,
sources-0.0.1]
to_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247
to_spec at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256
gem at /opt/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1195

Our rails app previous used rack, for example in the environment file :

require ‘lib/jsonp’
config.middleware.use ‘Rack::JSONP’

Further information - I reinstalled the normal Rack gem, and it gets
farther - but similar error as in the first post:

=> Booting WEBrick
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
NoMethodError: undefined method `name’ for “jruby-rack”:String
== at
/Users/krishdasgupta/projects/nascarfantasy2/vendor/rails/railties/lib/rails/gem_dependency.rb:268
=== at org/jruby/RubyKernel.java:1862
matching_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217
each at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410
each at org/jruby/RubyArray.java:1603
each at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:409
find_all at org/jruby/RubyEnumerable.java:673
matching_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216
to_specs at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238
to_spec at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256
gem at
/opt/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1195
add_load_paths at
/Users/krishdasgupta/projects/nascarfantasy2/vendor/rails/railties/lib/rails/gem_dependency.rb:73