I will have to take a look later, but I would bet we added some
mandatory piece of state in Ruby that getDefaultInstance() is not
setting up.  I can take a look this evening for a bit...Looking
at how BSF sets things up may glean something since that appears to
be working.

-Tom

On Tue, 28 Mar 2006, Werner Schuster (murphee) defenestrated me:

> Thomas E Enebo wrote:
> 
> >JRuby 0.8.3 has been released.  This version fixes a 
> >huge number of problems and boasts the following notables:
> > 
> >
> 
> Thanks for the new release!
> 
> But: I tested this with the EclipseShell JRuby support (ie. simply 
> replaced it's JRuby jar with 0.8.3 from 0.8.2),
> and now I keep on getting Exceptions when I evaluate some expressions.
> 
> Evaluating "1+1" and assignments seem to work, but anything else causes 
> various exceptions.
> 
> Eg. evaluating
>   require 'java'
> causes:
> java.lang.NullPointerException
>    at 
> org.jruby.evaluator.EvaluateVisitor$VCallNodeVisitor.execute(EvaluateVisitor.java:1923)
>    at 
> org.jruby.evaluator.EvaluationState.executeNext(EvaluationState.java:211)
>    at org.jruby.evaluator.EvaluationState.begin(EvaluationState.java:291)
>    at org.jruby.Ruby.eval(Ruby.java:188)
>    at org.jruby.Ruby.evalScript(Ruby.java:181)
>    at 
> org.ruby.eclipse.rubyenvironment.providers.JRubyEnvironment.execute(JRubyEnvironment.java:95)
>    at 
> net.sf.eclipseshell.editors.InterpreterEditor$EvaluateJob.run(InterpreterEditor.java:568)
>    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
> 
> Evaluating
>  def foo
>   "Foo"
>  end
> 
> causes:
> java.lang.ArrayIndexOutOfBoundsException: -1
>    at java.util.ArrayList.get(ArrayList.java:323)
>    at org.jruby.util.UnsynchronizedStack.peek(UnsynchronizedStack.java:26)
>    at org.jruby.runtime.ThreadContext.peekCRef(ThreadContext.java:453)
>    at 
> org.jruby.evaluator.EvaluateVisitor$DefnNodeVisitor.execute(EvaluateVisitor.java:895)
>    at 
> org.jruby.evaluator.EvaluationState.executeNext(EvaluationState.java:211)
>    at org.jruby.evaluator.EvaluationState.begin(EvaluationState.java:291)
>    at org.jruby.Ruby.eval(Ruby.java:188)
>    at org.jruby.Ruby.evalScript(Ruby.java:181)
>    at 
> org.ruby.eclipse.rubyenvironment.providers.JRubyEnvironment.execute(JRubyEnvironment.java:95)
>    at 
> net.sf.eclipseshell.editors.InterpreterEditor$EvaluateJob.run(InterpreterEditor.java:568)
>    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
> 
> 
> I tried debugging this, but I couldn't really figure out what's up; one 
> place where an NPE happened was in the
> EvaluateVisitor, line 1028 (last line of method public void 
> execute(EvaluationState state, InstructionContext ctx) );
> 
> 
> 
> Now... this worked before, so I'm wondering if you changed something in 
> the way a org.jruby.Ruby instance must be used.
> Basically, what I do:
> 
> ruby_ = Ruby.getDefaultInstance();
> 
> Then reuse this ruby_ field to evaluate Scripts:
>  obj = ruby_.evalScript(code);
> 
> Do I have to set something else up?
> 
> Notes:
>  - I run these evalScript calls from different threads each time, is 
> that a problem?
>  - I use Java 5
> 
> 
> 
> Thanks,
> 
> murphee
> -- 
> Blog @ http://jroller.com/page/murphee
> Maintainer of EclipseShell @ http://eclipse-shell.sourceforge.net/
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Jruby-devel mailing list
> Jruby-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jruby-devel

-- 
+ http://www.tc.umn.edu/~enebo +---- mailto:[EMAIL PROTECTED] ----+
| Thomas E Enebo, Protagonist  | "Luck favors the prepared    |
|                              |  mind." -Louis Pasteur       |


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to