Warbler 1.2.1, Rails 2.3.8 and Tomcat - RackInitializationException: no such file to load

I have a Rails 2.3.8 app that I have been building successfully with
Warbler
1.1.0 and JRuby 1.5.1. It ran great under Tomcat. I just updated to
Warbler
1.2.1, enabled the “compiled” feature in Warbler and now I’m getting the
following error in my Tomcat logs:

SEVERE: Error: unable to initialize application
org.jruby.rack.RackInitializationException: no such file to load –
/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environments/staging.class
from
file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-stdlib-1.5.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:inrequire’
from
/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in
new_constants_in' from /home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:inrequire’
from
/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environments/staging.rb:1:in
`load_environment’

    at

org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:184)
at
org.jruby.rack.PoolingRackApplicationFactory$1.run(PoolingRackApplicationFactory.java:157)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jruby.exceptions.RaiseException: no such file to load –
/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environments/staging.class
at
(unknown).new(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-stdlib-1.5.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31)
at
Kernel.require(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-stdlib-1.5.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31)
at
Kernel.require(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156)
at
ActiveSupport::Dependencies::Loadable.require(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521)
at
ActiveSupport::Dependencies.new_constants_in(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156)
at
ActiveSupport::Dependencies::Loadable.require(/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environments/staging.rb:1)
at
Rails::Initializer.load_environment(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/core_ext/kernel/reporting.rb:11)
at
Kernel.eval(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/rails-2.3.8/lib/initializer.rb:386)
at
Rails::Initializer.load_environment(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/activesupport-2.3.8/lib/active_support/core_ext/kernel/reporting.rb:11)
at
Kernel.silence_warnings(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/rails-2.3.8/lib/initializer.rb:379)
at
Rails::Initializer.load_environment(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/rails-2.3.8/lib/initializer.rb:137)
at
Rails::Initializer.process(/home/myuser/apps/tomcat/tomcat/webapps/ROOT/WEB-INF/gems/gems/rails-2.3.8/lib/initializer.rb:113)
at #Class:01x2e4f7bc2.run(config/environment.rb:9)
at
Kernel.load(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.1.jar!/jruby/rack/rails.rb:44)
at
JRuby::Rack::RailsBooter::Rails2Environment.load_environment(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.1.jar!/jruby/rack/rails.rb:38)
at
JRuby::Rack::RailsBooter::Rails2Environment.to_app(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.1.jar!/jruby/rack/rails.rb:186)
at #Class:01x1393537d.new(:2)
at
(unknown).(unknown)(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.1.jar!/vendor/rack-1.1.0/rack/builder.rb:46)
at
Kernel.instance_eval(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.1.jar!/vendor/rack-1.1.0/rack/builder.rb:46)
at
Kernel.instance_eval(file:/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.1.jar!/vendor/rack-1.1.0/rack/builder.rb:46)
at Rack::Builder.initialize(:2)
at (unknown).new(:2)
at (unknown).(unknown)(:1)

I have checked, double-checked and even triple-checked that the file
it’s
complaining actually exists.

Here’s what I have installed for gems:

$ jruby -S gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
columnize (0.3.1)
jruby-jars (1.5.1)
jruby-openssl (0.7)
jruby-rack (1.0.1)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
rubyzip (0.9.4)
sources (0.0.1)
warbler (1.2.1, 1.1.0)

If I disable the “compiled” feature, it works fine. Any suggestions?

Is there a staging.class file in the
/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environments/
path? The error message means the classloader could not find the file
and
load it properly.

I also have some issue to open the threadsafe feature with spree in
JRuby +
Tomcat. I posted a question in the jruby mail list and get a tip. It
sounds
like the spree haven’t considered the jruby and haven’t consider the
threadsafe feature. So it might lazy-load something which may break the
threadsafe mode, but I haven’t tried to change the code to see if it
works.

I guess It might also the similar issue for the compiled mode for JRuby,
it
worth a try.

Best wishes,
Stanley Xu

/home/myuser/apps/tomcat/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environments/staging.class
definitely exists on disk.

And this isn’t using Spree.

-Sean

Sorry I missed this thread. It’s possibly a bug in JRuby or Warbler.
Can you make a compiled war file exhibiting the behavior that you can
post to http://bugs.jruby.org?

Thanks,

/Nick