Torquebox JRuby/Rails app rarely loads

I am having one heck of a time keeping an app running. Every time I
restart the app for any reason (and it’s in staging, so it restarts A
LOT), I get this “JRuby puke”:

javax.servlet.ServletException: org.jruby.exceptions.RaiseException:
(NoMethodError) undefined method `each’ for nil:NilClass
org.torquebox.web.servlet.RackFilter.doRack(RackFilter.java:117)
org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:101)
org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:72)
root cause

org.jruby.exceptions.RaiseException: (NoMethodError) undefined method
`each’ for nil:NilClass
ClassMethods.register_javascript_expansion(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb:68)
(Anonymous).Railtie(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_view/railtie.rb:21)
org.jruby.RubyKernel.instance_eval(org/jruby/RubyKernel.java:2045)
(Anonymous).execute_hook(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36)
(Anonymous).on_load(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:26)
(Anonymous).Railtie(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_view/railtie.rb:20)
org.jruby.RubyKernel.instance_exec(org/jruby/RubyKernel.java:2062)
Rails::Initializable::Initializer.run(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:30)
(Anonymous).run_initializers(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:55)
org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615)
Initializable.run_initializers(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:54)
Application.initialize!(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/application.rb:136)
Class.method_added(file:/f:/torquebox-2.0.3/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:89)
org.jruby.RubyKernel.send(org/jruby/RubyKernel.java:2076)
ClassMethods.method_missing(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30)
(Anonymous).(root)(F:/Websites/rsacfod-torque/config/environment.rb:5)
org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033)
ActiveSupport::Dependencies::Loadable.require(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251)
ActiveSupport::Dependencies::Loadable.load_dependency(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236)
ActiveSupport::Dependencies::Loadable.require(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251)
(Anonymous).(root)(F:/Websites/rsacfod-torque/config/environment.rb:5)
org.jruby.RubyKernel.instance_eval(org/jruby/RubyKernel.java:2045)
Builder.initialize(f:/torquebox-2.0.3/jruby/lib/ruby/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51)
(Anonymous).(root)(F:\Websites\rsacfod-torque\config.ru:2)

Now it says it’s something to do with javascript_tag_helpers.rb. Is this
really possible? I was leaning more toward jdbc/mysql stuff.

I’m deploying to Torquebox 2.0.3. I’ve attempted to move to Torquebox
2.3.0, but this Windows server refuses to start it as a service… and I
can’t just start it from a command line and leave it logged in.

Does anyone see anything in this trace that I may not be seeing?

Thanks,
-Jim

When I’ve seen other TorqueBox users report this kind of issue in the
past, there’s usually a Rails initialization error earlier in the logs
that’s the real cause of the failure. Look a bit earlier in the logs and
see if you see some an error thrown when TorqueBox tries to initialize
the Rails runtime.

Ben

Running Torquebox from the commandline gives me this before the error I
was seeing:

17:54:59,953 ERROR [org.torquebox.core.runtime] (http-/127.0.0.1:8080-1)
Error during execution: require %q(rack)
Rack::Builder.new{(

This file is used by Rack-based servers to start the application.

require ::File.expand_path(’…/config/environment’, FILE)
run Rsacfod::Application

)}.to_app: org.jruby.exceptions.RaiseException: (NoMethodError)
undefined method `each’ for nil:NilClass

So it’s a rack error? This app runs in Trinidad (albeit poorly and
without serving assets). So it’s just Torquebox.

-Jim