Hello guys,
I am following the instructions in the book JRuby on Rails in the
“chapter 9 - A JRuby enterpise Bean” and I am getting a strange error.
I have glassfish correctly installed and working. I am using Eclipse
Java EE perpective to create the bean and deploy it to the server. The
Bean compiles and is deployed with no issues to glassfish.
I have created the little shell (called runjr.sh) at the end of the
page 179 adding the glassfish JARs to the classpath as follows:
#!/bin/sh
GLASSFISH=/usr/local/java_ee
DOMAIN=${GLASSFISH}/domains/domain1
export CLASSPATH=${CLASSPATH}:${GLASSFISH}/lib/appserv-rt.jar
export CLASSPATH=${CLASSPATH}:${GLASSFISH}/lib/j2ee.jar
export CLASSPATH=${CLASSPATH}:${GLASSFISH}/lib/j2ee-svc.jar
export CLASSPATH=${CLASSPATH}:${GLASSFISH}/lib/javaee.jar
export CLASSPATH=${CLASSPATH}:${DOMAIN}/applications/j2ee-modules/
JRubyEJB/com/bb/BBServiceRemote.class
export CLASSPATH=${CLASSPATH}:${DOMAIN}/applications/j2ee-modules/
JRubyEJB/com/bb/BBService.class
jruby $*
I have created the JRuby script described in page 180 as follows:
require ‘java’
import javax.naming.InitialContext
ic = InitialContext.new
x = ic.lookup(“com.bb.BBServiceRemote”)
x.invoke(“admin”,“admin”,“create”,“seq1”)
puts x.invoke(“admin”,“admin”,“next”,“seq1”)
puts x.invoke(“admin”,“admin”,“next”,“seq1”)
puts x.invoke(“admin”,“admin”,“next”,“seq1”)
When I run the script (runjr.sh bbservicecall.rb) I receive this error:
com/sun/ejb/EJBUtils.java:425:in `lookupRemote30BusinessObject’:
javax.naming.NamingException: ejb ref resolution error for remote
business interfacecom.bb.BBServiceRemote (NativeException)
I have read some post about this error and some of them describes that
the issue is that the client application (the JRuby script in this
case), tries to resolve the Interface in its own scope instead of it
remotely. So they suggest to explicitely include the interface and the
bean in the classpath, which I did. But it still does not work. Any
suggestions? I work with Mac OS X 10.5.6 and jruby 1.1.5.
Thanks in advance,
GA