[rjb-users] Can't find jarfile classes with Rails

rjb-users at rubyforge.org rjb-users at rubyforge.org
Mon Nov 20 10:18:16 EST 2006


Hi Arton,

I tried setting LD_PRELOAD, and it worked! Using the
same setup as in my original posting:

$ export
LD_LIBRARY_PATH=/usr/java/jdk1.5.0_09/jre/lib/amd64:/usr/java/jdk1.5.0_09/jre/lib/amd64/server

$ export
LD_PRELOAD=/usr/java/jdk1.5.0_09/jre/lib/amd64/libzip.so

export CLASSPATH="./junit-3.8.1.jar"

$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'rjb'
=> true
irb(main):003:0> require 'rjb'
=> true
irb(main):004:0> Rjb::import 'junit.framework.Assert'
=> #<Rjb::Junit_framework_Assert:0x2b85d75c23e8>

Many thanks for finding a solution!

--- arton <arton at e07.itscom.net> wrote:

> Hi all
> 
> Please reference 
>
http://www.mail-archive.com/java-linux@java.blackdown.org/msg15762.html
>
http://www.mail-archive.com/java-linux@java.blackdown.org/msg15763.html
>
http://www.mail-archive.com/java-linux@java.blackdown.org/msg15764.html
> 
> The conversation was stopped by fail, but my
> colleague found setting
> LD_PRELOAD is usable in his environment.
> So, please test with below.
> 
> % export
>
LD_LIBRARY_PATH=/opt/jdk1.5.0_09/jre/lib/amd64/server:/opt/jdk1.5.0_09/jre/lib/amd64
> % export
> LD_PRELOAD=/opt/jdk1.5.0_09/jre/lib/amd64/libzip.so 
> 
> Best regards
> 
> On Mon, 20 Nov 2006 14:00:06 +0900
> arton <arton at e07.itscom.net>¤µ¤ó wrote:
> 
> > Hi all
> > 
> > I've got some information about that Amd64 version
> of Rjb is crushed in
> > java.util.zip.Inflater. And I found Java's rt.jar
> was not compressed and
> > junit-4.1.jar was compressed.
> > So wouldn't you please un-jar and re-jar junit-4.1
> or other jars caused
> > InternalError without compression.
> > 
> > Ias, I apologised you that I've forgotten the
> Rjb's feature that emits
> > the stack-trace of Java'e exception if one sets
> $VERBOSE = true.
> > 
> > Regards.
> > 
> > On Sat, 18 Nov 2006 21:15:58 -0800 (PST)
> > richard apodaca <rich_apodaca at yahoo.com>¤µ¤ó
> wrote:
> > 
> > > Hi Arton,
> > > 
> > > Well, at least we've narrowed it down to my
> platform.
> > > Was the other user's platform also Linux amd64?
> > > 
> > > $ cat /proc/version
> > > Linux version 2.6.17-5mdv
> (rtp at ramanujan.mandriva.com)
> > > (gcc version 4.1.1 20060724 (prerelease)
> (4.1.1-3mdk))
> > > #1 SMP Wed Sep 13 14:28:02 EDT 2006
> > > 
> > > $ ruby -v
> > > ruby 1.8.5 (2006-08-25) [x86_64-linux-gnu]
> > > 
> > > $ rails -v
> > > Rails 1.1.6
> > > 
> > > 
> > > $ java -version
> > > java version "1.5.0_09"
> > > Java(TM) 2 Runtime Environment, Standard Edition
> > > (build 1.5.0_09-b01)
> > > Java HotSpot(TM) 64-Bit Server VM (build
> 1.5.0_09-b01,
> > > mixed mode)
> > > 
> > > 
> > > --- arton <arton at e07.itscom.net> wrote:
> > > 
> > > > Hi, Rich
> > > > 
> > > > I've heard the issue from Ias (CCed with this
> mail).
> > > > But I couldn't reproduce with Ruby 1.8.5, rjb
> 1.0.2,
> > > > rails 1.1.6 on
> > > > Win32(x86).
> > > > By the way, the mailing list is working, I
> think.
> > > > 
> > > > irb(main):001:0> require 'rubygems'
> > > > => true
> > > > irb(main):002:0> require_gem 'rails'
> > > > => true
> > > > irb(main):003:0> require_gem 'rjb'
> > > > => true
> > > > irb(main):004:0> require 'rjb'
> > > > => true
> > > > irb(main):005:0> Rjb::import
> > > > 'junit.framework.Assert'
> > > > => #<Rjb::Junit_framework_Assert:0x38b042c>
> > > > 
> > > > and on Linux (ruby 1.8.5, rjb 1.0.2,
> rails-1.1.6)
> > > > 
> > > > irb(main):001:0> require 'rubygems'
> > > > => true
> > > > irb(main):002:0> require_gem 'rails'
> > > > => true
> > > > irb(main):003:0> require_gem 'rjb'
> > > > => true
> > > > irb(main):004:0> require 'rjb'
> > > > => true
> > > > irb(main):005:0> Rjb::import
> > > > 'jp.co.infoseek.hp.arton.rjbtest.TestBean'
> > > > =>
> > > >
> > >
>
#<Rjb::Jp_co_infoseek_hp_arton_rjbtest_TestBean:0x40814184>
> > > > irb(main):006:0> exit
> > > > 
> > > > $ cat /proc/version
> > > > Linux version 2.4.33-smp (root at coral) (gcc
> version
> > > > 2.95.4 20011002 (Debian prerelease)) #1 SMP
> Tue Oct
> > > > 31 15:24:38 JST 2006
> > > > 
> > > > Both are running with Java 1.5.0_*
> > > > 
> > > > $ java -version
> > > > java version "1.5.0_04"
> > > > Java(TM) 2 Runtime Environment, Standard
> Edition
> > > > (build 1.5.0_04-b05)
> > > > Java HotSpot(TM) Client VM (build
> 1.5.0_04-b05,
> > > > mixed mode, sharing)
> > > > 
> > > > C:\home\arton>java -version
> > > > java version "1.5.0_09"
> > > > Java(TM) 2 Runtime Environment, Standard
> Edition
> > > > (build 1.5.0_09-b01)
> > > > Java HotSpot(TM) Client VM (build
> 1.5.0_09-b01,
> > > > mixed mode, sharing)
> > > > 
> > > > What is your version of Rails and Java ?
> > > > 
> > > > On Sat, 18 Nov 2006 13:47:10 -0800 (PST)
> > > > richard apodaca
> <rich_apodaca at yahoo.com>¡¢¥ª¡¢s wrote:
> > > > 
> > > > > Hi Arton,
> > > > > 
> > > > > I'm not sure if the rjb mailing list is
> working,
> > > > so
> > > > > I'll send this to you directly.
> > > > > 
> > > > > I am having problems with RJB importing a
> class
> > > > from a
> > > > > jarfile when using Rails.
> > > > > 
> > > > > The following works fine (on Linux amd64):
> > > > > 
> > > > > (1) Create a directory called 'test', and
> copy a
> > > > > jarfile into it (I'm using Junit
> > > > 'junit-3.8.1.jar',
> > > > > but any jarfile will do).
> > > > > 
> > > > > (2) export CLASSPATH="./junit-3.8.1.jar"
> > > > > 
> > > > > (3) $ irb
> > > > > irb(main):001:0> require 'rubygems'
> > > > > => true
> > > > > irb(main):002:0> require_gem 'rjb'
> > > > > => true
> > > > > irb(main):003:0> require 'rjb'
> > > > > => true
> > > > > irb(main):004:0> Rjb::import
> > > > 'junit.framework.Assert'
> > > > > => #
> > > > > 
> > > > > So far so good.
> > > > > 
> > > > > But loading Rails first and then the JUnit
> class
> > > > > fails:
> > > > > 
> > > > > $ irb
> > > > > irb(main):001:0> require 'rubygems'
> > > > > => true
> > > > > irb(main):002:0> require_gem 'rails'
> > > > > => true
> > > > > irb(main):003:0> require_gem 'rjb'
> > > > > => true
> > > > > irb(main):004:0> require 'rjb'
> > > > > => true
> > > > > irb(main):005:0> Rjb::import
> > > > 'junit.framework.Assert'
> > > > > InternalError: unknown exception
> 
=== message truncated ===


____________________________
Richard Apodaca
Blog: http://depth-first.com


 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$420k for $1,399/mo. Calculate new payment! 
www.LowerMyBills.com/lre


More information about the rjb-users mailing list