I currently developing an application based on JRuby/Rails. I am pretty happy with that combination and I haven’t many issues until a few weeks ago. I am using NetBeans 6.1 and the shipped JRuby version 1.1.2. The problems began when I started to use ResourceBundles in Rails, hence, mixing Java and Ruby/Rails code. After that my tests didn’t compile anymore. The weird thing is that at first this seemed to occur randomly, but I then I found the problem line. Nevertheless, it didn’t help because a) the line was correct and b) I depend on using Java. After some research, yes I am mean I googled, I found not much. Only a somwhat like bug report on codehaus (some of the geniuses behind JRuby). I talked to a Netbeans engineers and he said I should wait for JRuby 1.1.3 because it is coming out in a few days. And guess what? The new release fixed the problem I am able to program with running tests again. Not only this, JRuby 1.1.3 has a lot of perfomance fixes, especially the startup, which is also a big gain. Thx JRuby guys! Btw. I am now coding with Netbeans 6.5 (daily, I am waiting for the m2( and 6.5 is just amazing, so thx Netbeans guys!
The bottom line is: if you have this error upgrade to JRuby 1.1.3
Here is the exception from JRuby:
Exception in thread "main" java.lang.ClassCastException: org.jruby.RubyArray cannot be cast to org.jruby.ast.ListNode at org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1581) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:468) at org.jruby.evaluator.ASTInterpreter.ensureNode(ASTInterpreter.java:1084) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:364) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150) at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:96) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:275) at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115) at org.jruby.runtime.Block.yield(Block.java:109) at org.jruby.RubyArray.each(RubyArray.java:1311) at org.jruby.RubyArrayInvoker$each_method_0_0.call(Unknown Source) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:295) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278) at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:91) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:278) at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:675) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:174) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:150) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:225) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:123) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediator.rescue_2$RUBY$__rescue__(C:\Program Files\NetBeans 6.5 M1\ruby2\nb_test_mediator.rb:134) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediator.block_6$RUBY$__block__(C:\Program Files\NetBeans 6.5 M1\ruby2\nb_test_mediator.rb:132) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediatorBlockCallback$block_6$RUBY$__block__xx1.call(Unknown Source) at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:107) at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:88) at org.jruby.runtime.Block.yield(Block.java:109) at org.jruby.RubyArray.each(RubyArray.java:1311) at org.jruby.RubyArrayInvoker$each_method_0_0.call(Unknown Source) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:139) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:312) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediator.method__5$RUBY$run_mediator(C:\Program Files\NetBeans 6.5 M1\ruby2\nb_test_mediator.rb:129) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediatorInvokermethod__5$RUBY$run_mediatorFixed0.call(Unknown Source) at org.jruby.internal.runtime.methods.CompiledMethod.call(CompiledMethod.java:48) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:123) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediator.__file__(C:\Program Files\NetBeans 6.5 M1\ruby2\nb_test_mediator.rb:193) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediator.__file__(C:\Program Files\NetBeans 6.5 M1\ruby2\nb_test_mediator.rb) at ruby.C_3a_.Program_20_Files.NetBeans_20_6_dot_5_20_M1.ruby2.nb_test_mediator.load(C:\Program Files\NetBeans 6.5 M1\ruby2\nb_test_mediator.rb) at org.jruby.Ruby.runScript(Ruby.java:512) at org.jruby.Ruby.runNormally(Ruby.java:432) at org.jruby.Ruby.runFromMain(Ruby.java:312) at org.jruby.Main.run(Main.java:144) at org.jruby.Main.run(Main.java:89) at org.jruby.Main.main(Main.java:80)

Recent Links Tagged With "jruby" - JabberTags responded on 30 Sep 2008 at 12:04 pm #
[...] links >> jruby ERubyCon - Charles Nutter talks JRuby Saved by jamielpeters on Sun 28-9-2008 ClassCastException in JRuby 1.1.2 - org.jruby.RubyArray cannot be … Saved by macosxlepord on Sun 28-9-2008 Deploying with JRuby Saved by JSagalovsky on Sat 27-9-2008 [...]