Problem with JRuby, JTestr, and Hadoop

I’m writing an application in Java that uses Hadoop and is tested
with JTestr. Hadoop uses some classpath magic to find config files it
needs. I can verify that my classpath is correct, because if I make a
minimal JUnit test, everything works fine. However, when I try to do
the same thing in JTestr, I get weird exceptions, which I’ve tracked
down to the fact that the config files aren’t being located.

Does JRuby and/or JTestR interact strangely with the classloader such
that it would interfere with finding resources on the classpath?

-Bryan


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 5/15/08, Bryan D. [email protected] wrote:

I’m writing an application in Java that uses Hadoop and is tested with
JTestr. Hadoop uses some classpath magic to find config files it needs. I
can verify that my classpath is correct, because if I make a minimal JUnit
test, everything works fine. However, when I try to do the same thing in
JTestr, I get weird exceptions, which I’ve tracked down to the fact that the
config files aren’t being located.

Does JRuby and/or JTestR interact strangely with the classloader such that
it would interfere with finding resources on the classpath?

I’m guessing a bit here, but I have had classpath problems in JRuby
when Spring tried to use the Thread’s context class loader. You might
try this in your before block and see if it fixes your problem:

java.lang.Thread.current_thread.context_class_loader =
JRuby.runtime.getJRubyClassLoader


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I get “uninitialized cconstant JRuby” if I try that.

-Bryan

You need:
require ‘jruby’

Thanks,
–Vladimir

On Thu, May 15, 2008 at 10:00 PM, Bryan D. [email protected]
wrote:

I get “uninitialized cconstant JRuby” if I try that.
-Bryan
On May 15, 2008, at 11:38 AM, Tyler J. wrote:

java.lang.Thread.current_thread.context_class_loader =

JRuby.runtime.getJRubyClassLoader


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Holy crap! That makes it work. (Well, not my test, just the
infrastructure parts :).

Thanks to everyone who contributed.

-Bryan

On May 15, 2008, at 1:08 PM, Vladimir S. wrote:

On May 15, 2008, at 11:38 AM, Tyler J. wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

require ‘java’ first. Sorry, I skipped right over that.

On 5/15/08, Bryan D. [email protected] wrote:

JRuby.runtime.getJRubyClassLoader


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs