Hello,
I don’t understand (and suspect a jruby bug) why 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)
Details below. Am I doing something wrong? A known issue? Or is it a bug
that needs to be reported?
-
Case 1: jruby ./integration-test.rb -> All fine [Prints out
numbers from 1 to 100]
-
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
#./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
This email and any attachments are confidential, and may be legally
privileged and protected by copyright. If you are not the intended
recipient dissemination or copying of this email is prohibited. If you
have received this in error, please notify the sender by replying by
email and then delete the email completely from your system. Any views
or opinions are solely those of the sender. This communication is not
intended to form a binding contract unless expressly indicated to the
contrary and properly authorised. Any actions taken on the basis of this
email are at the recipient’s own risk.