JSR223 behavior differs from ScriptingContainer when embedding
--------------------------------------------------------------
Key: JRUBY-5789
URL: http://jira.codehaus.org/browse/JRUBY-5789
Project: JRuby
Issue Type: Bug
Components: Embedding
Affects Versions: JRuby 1.6.1
Reporter: Justin Coyne
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine jruby = manager.getEngineByName("jruby");
jruby.eval(new BufferedReader(new FileReader("myruby.rb"))
Causes this error:
org.jruby.exceptions.RaiseException: (ArgumentError) $! not set.
javax.script.ScriptException: org.jruby.exceptions.RaiseException:
(ArgumentError) $! not set.
at
org.jruby.embed.jsr223.JRubyEngine.wrapException(JRubyEngine.java:117)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:133)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:158)
at javax.script.ScriptEngine$eval.call(Unknown Source)
at corporate.Payment.submit(Payment.groovy:35)
at corporate.Payment$submit.call(Unknown Source)
at corporate.PaymentTests.testSubmit(PaymentTests.groovy:15)
Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) $! not set.
The equivalent script:
ScriptingContainer jruby = new ScriptingContainer();
def path = "myruby.rb"
jruby.runScriptlet(new FileInputStream(new File(path)), path)
Works fine.
myruby.rb is these few lines:
ENV['GEM_HOME'] = 'WEB-INF/gems'
require 'rubygems'
require 'savon'
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email