Been trying to run a rails app using terminal in jruby 1.9 mode. I tried the following, but ran into a series of errors:
$ jruby --1.9 script/rails s
LoadError: load error: /Users/aaronmcleod/Documents/sojou开发者_JS百科rner/config/boot -- java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to org.jruby.RubyException
require at org/jruby/RubyKernel.java:1047
require at /Users/aaronmcleod/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29
(root) at script/rails:5
This is caused by the new YAML parser which has some internal bugs. Check your yaml files, for any symbols, you have to replace them with strings. In my case it was:
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -13,7 +13,7 @@ de:
abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
- order: [ :day, :month, :year ]
+ order: [ "day", "month", "year" ]
time:
formats:
See also the related bug report: JRUBY-5802
You can determine the faulty yaml file by iterating over all files and try to parse them:
jruby --1.9 -ryaml -e 'ARGV.each {|file| puts file; YAML.load_file(file) }' $(find . -name '*.yml')
精彩评论