Could not run jruby-based app

Hey guys.

Can you help me to run my JRuby project :
https://github.com/rodionovp/recurly-jruby

When I run TestRecurly, I see some odd errors, here is a stacktrace :

SyntaxError:
file:C:/Users/rodionovp/idea_projects/test-ruby/src/main/resources/recurly-gems-0.4.11.jar!/gems/recurly-0.4.11/lib/recurly/verification.rb:51:
syntax error, unexpected ‘:’

*
*

  •    account_code: account_code*
    
  •                ^*
    
  • (root) at
    file:C:/Users/rodionovp/idea_projects/test-ruby/src/main/resources/recurly-gems-0.4.11.jar!/gems/recurly-0.4.11/lib/recurly/verification.rb:3
  • require at org/jruby/RubyKernel.java:1038*
  • require at
    C:/Users/rodionovp/idea_projects/test-ruby/target/classes/scripts/test.rb:29
  • (root) at :1*
    org.jruby.embed.EvalFailedException: (SyntaxError)
    file:C:/Users/rodionovp/idea_projects/test-ruby/src/main/resources/recurly-gems-0.4.11.jar!/gems/recurly-0.4.11/lib/recurly/verification.rb:51:
    syntax error, unexpected ‘:’
  •    account_code: account_code*
    
  •                ^*
    
  • at
    org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)*
  • at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:90)*
  • at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:153)*
  • at TestRecurly.main(TestRecurly.java:15)*
  • at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
  • at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  • at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  • at java.lang.reflect.Method.invoke(Method.java:601)*
  • at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)*

But when I comment out this line in test.rb : *#puts
Recurly::Verification::digest_data(‘ABC’) . The error is different: *
*

:1 warning: warning: variable $= is no longer effective
javax.script.ScriptException: org.jruby.exceptions.RaiseException:
(ArgumentError) $! not set.
*

Hello!

On Tue, Sep 13, 2011 at 6:39 AM, Pavel R. [email protected]
wrote:

file:C:/Users/rodionovp/idea_projects/test-ruby/src/main/resources/recurly-gems-0.4.11.jar!/gems/recurly-0.4.11/lib/recurly/verification.rb:3

org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:90)
at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:153)
at TestRecurly.main(TestRecurly.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

I think recurly gem is using 1.9 Hash syntax. From the stack trace,
you are using JSR223, so setting a system property,

System.setProperty(“org.jruby.embed.compat.version”, “JRuby1.9”);

may resolve the syntax error.

But when I comment out this line in test.rb :#puts
Recurly::Verification::digest_data(‘ABC’) . The error is different:
:1 warning: warning: variable $= is no longer effective
javax.script.ScriptException: org.jruby.exceptions.RaiseException:
(ArgumentError) $! not set.

This looks like a bug of JSR223 implementation. Would you file this
exception issue?

-Yoko

Fantastic. It works!

Thank you very much :slight_smile:

2011/9/13 Yoko H. [email protected]