2011-05-18 121 views
1

一直試圖在jruby 1.9模式下使用終端來運行rails應用程序。我嘗試了以下,但遇到了一系列的錯誤:在1.9模式下使用Jruby運行rails應用程序?

$ jruby --1.9 script/rails s 
LoadError: load error: /Users/aaronmcleod/Documents/sojourner/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 

回答

2

這是由新的YAML分析器,它有一些內部的錯誤引起的。檢查你的yaml文件,對於任何符號,你必須用字符串替換它們。在我的情況是:

--- 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: 

另見相關bug報告:JRUBY-5802

您可以確定通過遍歷所有文件故障YAML文件,並嘗試分析它們:

jruby --1.9 -ryaml -e 'ARGV.each {|file| puts file; YAML.load_file(file) }' $(find . -name '*.yml') 
+0

它可能是設計語言yml文件之一。因爲他們對所有翻譯有各種特殊字符。 – agmcleod 2011-05-19 11:59:33

+0

遍歷它們並嘗試解析它們,我將更新答案。 – reto 2011-05-19 12:10:47

+0

給出了一個鏡頭:jruby --1.9 -ryaml -e'ARGV.each {| file |放入文件; YAML.load_file(file)}'$(find。-name'* .yml') ./.gem/ruby/1.8/gems/activemodel-3.0.0.beta/lib/active_model/locale/en.yml ./.gem/ruby/1.8/gems/activesupport-3.0.0.beta/lib/active_support/locale/en.yml RubyException $ i $ 0 $ 2 $ initialize.gen:65535:in'call':java.lang。 ClassCastException:org.jruby.RubyObject不能轉換爲org.jruby.RubyException \t from CachingCallSite.java:242:in'cacheAndCall' – agmcleod 2011-05-19 13:10:23

相關問題