direct loading .class files fails with an IO Error 
---------------------------------------------------

                 Key: JRUBY-2630
                 URL: http://jira.codehaus.org/browse/JRUBY-2630
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.1.2
         Environment: Mac OS X 10.5, jruby 1.1.2
            Reporter: Fabio Kung


require fails for .class files with an IO error, but the class file gets 
actually loaded:

$ ls /Users/fck/abc/
Oi.class Oi.java
$ jirb -d
irb(main):001:0> o = Java::Abc::Oi.new
NameError: cannot load Java class abc.Oi
        from (irb):2:in `const_missing'
        from (irb):2:in `binding'
irb(main):002:0> require "/Users/fck/abc/Oi"
java.lang.ClassCastException: abc.Oi
        at 
org.jruby.runtime.load.JavaCompiledScript.load(JavaCompiledScript.java:70)
        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.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.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:224)
        at org.jruby.RubyKernel.eval(RubyKernel.java:814)
        at org.jruby.RubyKernelInvoker$eval_s_method_0_3.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1134)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:370)
        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:204)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:670)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:324)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1115)
        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.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:309)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:187)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:366)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        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.rescueNode(ASTInterpreter.java:1556)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:468)
        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.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.Block.yield(Block.java:114)
        at 
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1850)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:509)
        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.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:275)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1139)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:370)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:170)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.Block.yield(Block.java:114)
        at 
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1850)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:509)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:620)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:318)
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1556)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:468)
        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.RubyKernel.loop(RubyKernel.java:1001)
        at org.jruby.RubyKernelInvoker$loop_s_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.fCallNode(ASTInterpreter.java:1139)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:370)
        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.RubyKernel.rbCatch(RubyKernel.java:842)
        at org.jruby.RubyKernelInvoker$rbCatch_s_method_1_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:397)
        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.fCallNode(ASTInterpreter.java:1139)
        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.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:204)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:107)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:264)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:670)
        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.RubyKernel.rbCatch(RubyKernel.java:842)
        at org.jruby.RubyKernelInvoker$rbCatch_s_method_1_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:397)
        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.fCallNode(ASTInterpreter.java:1139)
        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.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:267)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:155)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:332)
        at 
ruby.Users.fck.Development.Ruby.jruby_minus_1_dot_1_dot_2.bin.jirb.__file__(/Users/fck/Development/Ruby/jruby-1.1.2/bin/jirb:19)
        at 
ruby.Users.fck.Development.Ruby.jruby_minus_1_dot_1_dot_2.bin.jirb.__file__(/Users/fck/Development/Ruby/jruby-1.1.2/bin/jirb)
        at 
ruby.Users.fck.Development.Ruby.jruby_minus_1_dot_1_dot_2.bin.jirb.load(/Users/fck/Development/Ruby/jruby-1.1.2/bin/jirb)
        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)
LoadError: IO error -- /Users/fck/abc/Oi
        from (irb):3:in `require'
        from (irb):3:in `binding'
irb(main):003:0> o = Java::Abc::Oi.new      
=> #<Java::Abc::Oi:0x9b86ea @[EMAIL PROTECTED]>
irb(main):004:0>  

As stacktrace shows, The problem could be the cast between classes loaded from 
different class loaders.

-- 
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


Reply via email to