Calling ejb 1.1(WAS7) from a cmd line client


ejb1.1 service is deployed on WAS7.

jruby cmd line client is on jre7 and referencing webshpere components
jar and the ejb jar on classpath.

exception on context#lookup:
#<NativeException: javax.naming.NamingException: Failed to initialize
the ORB>
[“com/ibm/ws/naming/util/ `getOrb’”,

unable to understand the exception.

require 'java'

java_import ‘java.util.Properties’
java_import ‘javax.naming.InitialContext’
java_import ‘javax.naming.Context’

require ‘D:\java_ext\ibm\1.6\’
require ‘D:\java_ext\ibm\1.6\ibmorb.jar’

require ‘D:\my\ejb.jar’

require ‘pp’

class EjbFactory
def self.create(jndiBeanName)

prop.put(Context::PROVIDER_URL, “IIOP://server:2811/”)

  context =
rescue Exception => e
  pp e
  pp e.backtrace



I don’t think you can use the IBM Corba client that way (but I may be
out of date). My memory of the IBM Corba stuff is that it is fairly
deeply entangled with their Java.

Can you try running JRuby on IBM’s Java? (You mention jre7, but then
refer to IBM Java 1.6 jar files, so I’m assuming you are not running on
the IBM’s Java.)

Also, note that older JRuby releases have some quirks running on IBM’s
Java on Linux: frequent segmentation faults during JVM shutdown. This is
fixed in JRuby 1.7.0 and I think also in JRuby 1.6.8.

  • Bruce

hi Bruce,

Thanks for the reply.

We have used the ibm#was components from a sun#java (java code)client
earlier, it works mostly, as you said some quirks were observed, but
works mostly.




I got it wot work (partially though)

the jars were not in class path and had to instruct jvm to load the
correct ORB impl.

$CLASSPATH  << 'D:\java_ext\ibm\1.6\ibmorb.jar'
$CLASSPATH  << 'D:\java_ext\ibm\1.6\'
$CLASSPATH  << 'D:\java_ext\ibm\1.6\ibmcfw.jar'


However i’m stuck at creating an ejb.

objref = lookup("my/EJB")

myEjbHome = PortableRemoteObject.narrow(objref, MyEjbHome.class)
# fails with
# NativeException: java.lang.ClassCastException: Class 
org.jruby.RubyModule is not a valid remote interface

ejb = myEjbHome.create()



correct call is

mbUserHome = PortableRemoteObject.narrow(connobj, MyEjbHome.java_class)

but nil is returned, java returns the correct object.


sorry guys, missed out using the stubs’ jars in CLASSPATH.