2011-05-18 125 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

相关问题