JRuby

JRuby script engine does not load on IBM JDK

Details

  • Testcase included:
    yes
  • Number of attachments :
    2

Description

I've been trying to get the JRuby scripting engine loading up on the IBM JDK... its not working so good. All the other scripting engines load up fine on IBM's JDK. I've also tested this on Sun's JDK and JRuby loaded fine.

My attached test app (run with 'mvn clean install') spits out the following info in the test case surefire report:

-------------------------------------------------------------------------------
Test set: org.jrubytest.JRubyTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.175 sec <<< FAILURE!
testLoadingScriptingLanguages(org.jrubytest.JRubyTest) Time elapsed: 2.121 sec <<< ERROR!
file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47:in `require': IO error – builtin/java/regex (LoadError)
from file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47
from file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:1
...internal jruby stack elided...
from Kernel.require(file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47)
from (unknown).(unknown)(file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:1)
from (unknown).(unknown)(:1)

The builtin/java/regex is indeed in the jar so I'm not sure why it isn't loading. Anyone have any ideas?

  1. ruby-error.tar.gz
    23/Oct/08 6:25 PM
    2 kB
    Jonathan Anstey
  2. ruby-error-2.tar.gz
    30/Oct/08 7:58 AM
    1 kB
    Jonathan Anstey

Activity

Hide
Jonathan Anstey added a comment -

Hmm... it appears the servicemix-scripting component of Apache ServiceMix has a similar error on the IBM JDK

Caused by: org.jruby.exceptions.RaiseException: IO error – builtin/java/regex
Caused by: java.lang.AssertionError: CANON_EQ is not interned
at org.jruby.RubyModule.fastGetConstantAt(RubyModule.java:2326)
at org.jruby.javasupport.JavaClass$ConstantField.install(JavaClass.java:431)
at org.jruby.javasupport.JavaClass.setupProxy(JavaClass.java:689)
at org.jruby.javasupport.Java.createProxyClass(Java.java:533)
at org.jruby.javasupport.Java.getProxyClass(Java.java:487)
at org.jruby.javasupport.Java.get_proxy_class(Java.java:518)
at org.jruby.javasupport.Java$2.defineClassUnder(Java.java:240)
at org.jruby.RubyModule.searchProvidersForClass(RubyModule.java:274)
at org.jruby.RubyModule.defineOrGetClassUnder(RubyModule.java:1074)
at org.jruby.evaluator.ASTInterpreter.classNode(ASTInterpreter.java:783)
at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:328)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1654)
at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
at org.jruby.Ruby.loadFile(Ruby.java:2001)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320)
at org.jruby.runtime.load.LoadService.require(LoadService.java:346)
at org.jruby.RubyKernel.require(RubyKernel.java:770)
at org.jruby.RubyKernelInvoker$require_s_method_1_0.call(Unknown Source)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:397)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:78)
at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:155)
at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:332)
at org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1116)
at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:370)
at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1654)
at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
at org.jruby.Ruby.loadFile(Ruby.java:2001)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320)
at org.jruby.javasupport.Java.load(Java.java:88)
at org.jruby.ext.LateLoadingLibrary.load(LateLoadingLibrary.java:55)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320)
at org.jruby.runtime.load.LoadService.require(LoadService.java:346)
at com.sun.script.jruby.JRubyScriptEngine.init(JRubyScriptEngine.java:484)
at com.sun.script.jruby.JRubyScriptEngine.<init>(JRubyScriptEngine.java:96)
at com.sun.script.jruby.JRubyScriptEngineFactory.getScriptEngine(JRubyScriptEngineFactory.java:134)
at javax.script.ScriptEngineManager.getEngineByExtension(ScriptEngineManager.java:144)
at org.apache.servicemix.scripting.ScriptingEndpoint.start(ScriptingEndpoint.java:375)

The full log is here:
http://people.apache.org/~janstey/temp/org.apache.servicemix.scripting.ScriptingComponentTest.txt

Show
Jonathan Anstey added a comment - Hmm... it appears the servicemix-scripting component of Apache ServiceMix has a similar error on the IBM JDK Caused by: org.jruby.exceptions.RaiseException: IO error – builtin/java/regex Caused by: java.lang.AssertionError: CANON_EQ is not interned at org.jruby.RubyModule.fastGetConstantAt(RubyModule.java:2326) at org.jruby.javasupport.JavaClass$ConstantField.install(JavaClass.java:431) at org.jruby.javasupport.JavaClass.setupProxy(JavaClass.java:689) at org.jruby.javasupport.Java.createProxyClass(Java.java:533) at org.jruby.javasupport.Java.getProxyClass(Java.java:487) at org.jruby.javasupport.Java.get_proxy_class(Java.java:518) at org.jruby.javasupport.Java$2.defineClassUnder(Java.java:240) at org.jruby.RubyModule.searchProvidersForClass(RubyModule.java:274) at org.jruby.RubyModule.defineOrGetClassUnder(RubyModule.java:1074) at org.jruby.evaluator.ASTInterpreter.classNode(ASTInterpreter.java:783) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:328) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318) at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1654) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170) at org.jruby.Ruby.loadFile(Ruby.java:2001) at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58) at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320) at org.jruby.runtime.load.LoadService.require(LoadService.java:346) at org.jruby.RubyKernel.require(RubyKernel.java:770) at org.jruby.RubyKernelInvoker$require_s_method_1_0.call(Unknown Source) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:397) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:78) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:155) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:332) at org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1116) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:370) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318) at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1654) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170) at org.jruby.Ruby.loadFile(Ruby.java:2001) at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58) at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320) at org.jruby.javasupport.Java.load(Java.java:88) at org.jruby.ext.LateLoadingLibrary.load(LateLoadingLibrary.java:55) at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:320) at org.jruby.runtime.load.LoadService.require(LoadService.java:346) at com.sun.script.jruby.JRubyScriptEngine.init(JRubyScriptEngine.java:484) at com.sun.script.jruby.JRubyScriptEngine.<init>(JRubyScriptEngine.java:96) at com.sun.script.jruby.JRubyScriptEngineFactory.getScriptEngine(JRubyScriptEngineFactory.java:134) at javax.script.ScriptEngineManager.getEngineByExtension(ScriptEngineManager.java:144) at org.apache.servicemix.scripting.ScriptingEndpoint.start(ScriptingEndpoint.java:375) The full log is here: http://people.apache.org/~janstey/temp/org.apache.servicemix.scripting.ScriptingComponentTest.txt
Hide
Charles Oliver Nutter added a comment -

I'm all set to look at this but I'm not sure how to reproduce it. It looks like something we can fix, but I don't know where to start.

Show
Charles Oliver Nutter added a comment - I'm all set to look at this but I'm not sure how to reproduce it. It looks like something we can fix, but I don't know where to start.
Hide
Jonathan Anstey added a comment -

I know how you feel... its a nasty problem. I have narrowed it down a bit though. I've attaching a new test case that interfaces directly with JRuby (none of that JDK scripting api crap to confuse things). I'll attach it in a minute.

Show
Jonathan Anstey added a comment - I know how you feel... its a nasty problem. I have narrowed it down a bit though. I've attaching a new test case that interfaces directly with JRuby (none of that JDK scripting api crap to confuse things). I'll attach it in a minute.
Hide
Jonathan Anstey added a comment -

Simplified test case for issue. I've eliminated all other dependencies and now am using JRuby directly. Fails on IBM's JDK and passes on Sun's.

The code is essentially this:

Ruby runtime = Ruby.newInstance();        
        String loadPath = System.getProperty("java.class.path");
        List list = Arrays.asList(loadPath.split(File.pathSeparator));        
        runtime.getLoadService().init(list);                
        runtime.getLoadService().require("java");

on the last line in fails with the following stack:

file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47:in `require': IO error -- builtin/java/regex (LoadError)
        from file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47
        from file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:1
        ...internal jruby stack elided...
        from Kernel.require(file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47)
        from (unknown).(unknown)(file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:1)
        from (unknown).(unknown)(:1)

Thanks for looking into this Charles!

Show
Jonathan Anstey added a comment - Simplified test case for issue. I've eliminated all other dependencies and now am using JRuby directly. Fails on IBM's JDK and passes on Sun's. The code is essentially this:
Ruby runtime = Ruby.newInstance();        
        String loadPath = System.getProperty("java.class.path");
        List list = Arrays.asList(loadPath.split(File.pathSeparator));        
        runtime.getLoadService().init(list);                
        runtime.getLoadService().require("java");
on the last line in fails with the following stack:
file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47:in `require': IO error -- builtin/java/regex (LoadError)
        from file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47
        from file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:1
        ...internal jruby stack elided...
        from Kernel.require(file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:47)
        from (unknown).(unknown)(file:/home/janstey/.m2/repository/org/jruby/jruby/1.1.4/jruby-1.1.4.jar!/builtin/javasupport.rb:1)
        from (unknown).(unknown)(:1)
Thanks for looking into this Charles!
Hide
Jonathan Anstey added a comment -

By the way, I've just tried this too and am getting the same error:

String loadPath = System.getProperty("java.class.path");
        List list = Arrays.asList(loadPath.split(File.pathSeparator));        
        Ruby runtime = org.jruby.javasupport.JavaEmbedUtils.initialize(list);
Show
Jonathan Anstey added a comment - By the way, I've just tried this too and am getting the same error:
String loadPath = System.getProperty("java.class.path");
        List list = Arrays.asList(loadPath.split(File.pathSeparator));        
        Ruby runtime = org.jruby.javasupport.JavaEmbedUtils.initialize(list);
Hide
Charles Oliver Nutter added a comment -

This was a problem with how we bind constants from Java classes into Ruby classes. We expected that strings coming out of reflection would be interned, and so followed a fast path when binding them. But assertions on that fast path detected that the strings were not interned in IBM JVM, and caused these errors. I modified the binding process to use the slow path, which shouldn't really affect anything (using an interned string only saves the string hash cost, and then only in cases where it's been hashed before).

Fixed in r8715.

Show
Charles Oliver Nutter added a comment - This was a problem with how we bind constants from Java classes into Ruby classes. We expected that strings coming out of reflection would be interned, and so followed a fast path when binding them. But assertions on that fast path detected that the strings were not interned in IBM JVM, and caused these errors. I modified the binding process to use the slow path, which shouldn't really affect anything (using an interned string only saves the string hash cost, and then only in cases where it's been hashed before). Fixed in r8715.
Hide
Jonathan Anstey added a comment -

Thats awesome Charles! Thanks for the fix.

Show
Jonathan Anstey added a comment - Thats awesome Charles! Thanks for the fix.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: