Tomcat processes requests for a JRuby on Rails application before the application is fully loaded

I have a boundary case, although this is a very convenient client where Tomcat starts processing requests before all dependencies are loaded correctly for the Ruby on Rails stack under JRuby.

After restarting Tomcat, something similar to the following happens:

undefined method `utc_offset' for nil:NilClass
 [RAILS_ROOT]/gems/gems/activesupport-2.3.8/lib/active_support/values/time_zone.rb:206:in `<=>'

This happens when the following code is called in one of my services:

  @timezones = ActiveSupport::TimeZone.all

If you wait a few more seconds and refresh the requesting page, this will not cause problems.

Is there a way to ensure that Tomcat does not start processing these requests until the entire stack, ActiveSupport, ActiveRecord, etc. are loaded? Has anyone experienced any such symptoms?

+3
2

JRuby-Rack, , Rails Tomcat. JRuby-Rack /environment.rb, , , , , , - . (, , , ) , http://kenai.com/jira/browse/JRUBY_RACK http://bugs.jruby.org?

+1

, - Tomcat , javax.servlet.Filter, , . , . ( Ruby, ).

0

Source: https://habr.com/ru/post/1773892/


All Articles