Strange "unable to load language: ruby" behavior

Greetings!

First off, I am new to JRuby so please forgive my ignorance.

I am trying to use JRuby to embed ruby into the distributed processing
framework, Hadoop. However, I’m running into some problems loading
the ruby language. As a first test I wrote this stand-alone piece of
code:


import org.jruby.Ruby.;
import org.jruby.
;
import org.jruby.javasupport.bsf.*;
import org.apache.bsf.BSFException;
import org.apache.bsf.BSFManager;

class Example {
public static void main(String[] args) throws Exception {
BSFManager bsfManager = new BSFManager();
StringBuffer foo = new StringBuffer("Hello ");
BSFManager.registerScriptingEngine(“ruby”,
“org.jruby.javasupport.bsf.JRubyEngine”, new String[] { “rb” });
bsfManager.declareBean(“foo”, foo, StringBuffer.class);

bsfManager.exec("ruby", "(java)", 1,1, "$foo.append('world'); ");
System.out.println(foo.toString());

}
}

Running this works exactly how you would want, producing “Hello
world”. However, when I do something similar withing the Hadoop
framework, I get errors like:

BSF Raised and exception with reason: 500
org.apache.bsf.BSFException: unable to load language: ruby

I am launching the java process from which this originates with both
jruby.jar and bsf.jar in the classpath and bsf.jar is in the java ext
directory. (I’ve also tried javascript, with the same result.)

Can anybody give me more information on why this might be happening?
Does anybody have any pointers regarding debugging this? Any info
will help.

Many thanks!

-lincoln


lincolnritter.com


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