I am developing a project using Rails on jRuby. All were good until a strange issue triggers an internal server error. It's strange that in some occasions it loads perfectly, although there's no change in code anywhere.
It originates from the line:
<%= stylesheet_link_tag 'application', media: 'all' %>
and the error is:
undefined method `_parse' for Java::JavaUtil::Date:Class
The top few line of the stack trace looks like:
<home_dir>/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/time.rb:265:in `parse'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:79:in `initialize'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:47:in `init_with'
org/jruby/RubyArray.java:2409:in `map'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:46:in `init_with'
sprockets (2.11.0) lib/sprockets/asset.rb:24:in `from_hash'
sprockets (2.11.0) lib/sprockets/caching.rb:54:in `cache_asset'
sprockets (2.11.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.11.0) lib/sprockets/index.rb:61:in `find_asset'
...
As a general trouble shooting I've tried removing all the latest stylesheet and javascript files. Disabled turbolinks
but the problem persists.
Had anybody encountered this issue? Any suggestions how to overcome, or even how to bypass this issue?
Rails version: 4.1.4 jRuby version: jruby 1.7.10 (1.9.3p392)
you very likey have a import java.util.Date
or similar java_import Java::JavaUtil::Date
somewhere along your code which replaces the Ruby Date
constant with another one ...