Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0.RC2, JRuby 1.6.8
Assignee: Unassigned
Components: Java Integration
Created: 15/Oct/12 9:22 PM
Description:

My code fails midway through identical iterations with a NativeException:
java.lang.ClassNotFoundException. The code repeats the same thing over and
over.
Code works fine if all is in one file, however it fails towards the 50th
iteration if it's included from another file (which iteration exactly
changes each time, but so far in the range 48 to 56)

  1. Case 1: jruby ./integration-test.rb -> All fine [Prints out numbers from
    1 to 100]
  1. Case 2: jruby ./integration-test-2files.rb ->

NativeException: java.lang.ClassNotFoundException [Prints out numbers from
1 to 52, then spews out a
java/lang/ClassLoader.java:373:in `findClass':
java.lang.ClassNotFoundException: com.xxx.yyy.zzz.ttt.GGClassName
(NativeException)
from java/lang/ClassLoader.java:321:in `loadClass'
from java/lang/ClassLoader.java:266:in `loadClass'
from java/lang/Class.java:-2:in `forName0'
from java/lang/Class.java:264:in `forName'
from java/io/ObjectInputStream.java:621:in `resolveClass'
from java/io/ObjectInputStream.java:1592:in `readNonProxyDesc'
from java/io/ObjectInputStream.java:1513:in `readClassDesc'

The error message is slightly different with jruby 1.7.0RC2
LoadError: load error: integration-test – java.lang.ClassNotFoundException:
xxx.yyy.zzz.ttt.GGClassName
require at org/jruby/RubyKernel.java:1019

As subsequent test:
Note: jruby -X-C systematically fails, on both files [All 3 versions tested, error message varies, but always a ClassNotFound error]
jruby -X+C always works, on both files. [All 3 versions tested]

./jruby-1.6.8/bin/jruby -X-C integration-test.rb
NativeException: java.lang.ClassNotFoundException: xxx/yyy/zzz/ttt/GGClassNale
ReadStuff at integration-test.rb:13
(root) at integration-test.rb:21
upto at org/jruby/RubyInteger.java:135
(root) at integration-test.rb:21
[1] 373 exit 1 ./jruby-1.6.8/bin/jruby -X-C integration-test.rb

--------------
#./integration-test-2files.rb
require "java"
require 'integration-test'

--------------
#./integration-test.rb
require "java"

module JavaRead
require 'myjar.jar'
include_package 'com.xxx.yyy.zzz.ttt'
end

def JavaRead::ReadStuff(file)
myin=
java.io.ObjectInputStream.new(java.io.BufferedInputStream.new(java.io.FileInputStream.new(java.io.File.new(file))))
begin
while obj= myin.readObject
end
rescue java.io.EOFException # Don't know why Java is raising this one#
Likely strange input files
end
end

1.upto(100) {|i| JavaRead::ReadStuff("import/12.dmp") ; puts i}

Tested and reproduced with jruby

jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2011-10-27 6586) (OpenJDK 64-Bit
Server VM 1.6.0_24) [amd64-java]
jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (OpenJDK 64-Bit Server VM
1.6.0_24) [linux-amd64-java]
jruby 1.7.0.RC2 (1.9.3p203) 2012-10-09 142cc7b on OpenJDK 64-Bit Server VM
1.6.0_24-b24 [linux-amd64]

on a Ubuntu Precise Pagolin

Environment: Linux Ubuntu Precise Pagolin
Project: JRuby
Priority: Major Major
Reporter: André Allavena
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
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