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

rjb-users at rubyforge.org rjb-users at rubyforge.org
Sat Nov 18 22:46:02 EST 2006


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>さん 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
>         from (irb):5:in `import'
>         from (irb):5
> irb(main):006:0> Rjb::import 'junit.framework.Assert'
> NoClassDefFoundError: junit/framework/Assert
>         from (irb):6:in `import'
>         from (irb):6
>         from :0
> 
> Notice how I'm getting two different errors for the
> same invocation of Rjb::import.
> 
> Can you reproduce this bug?
> 
> thanks,
> Rich
> 
> ____________________________
> Richard Apodaca
> Blog: http://depth-first.com
> 
> 
>  
> ____________________________________________________________________________________
> Sponsored Link
> 
> Don't quit your job - take classes online
> www.Classesusa.com
> 

-- 
arton



More information about the rjb-users mailing list