# Ruby and EJavaBeans with RJB

**URL:** <https://www.ruby-forum.com/t/ruby-and-ejavabeans-with-rjb/103694>\
**Category:** Ruby\
**Created:** [May 9, 2007, 12:20pm UTC](https://www.ruby-forum.com/t/ruby-and-ejavabeans-with-rjb/103694 "2007-05-09T12:20:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alflol](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@alflol](https://www.ruby-forum.com/u/alflol)\
**Post date:** [May 9, 2007, 12:20pm UTC](https://www.ruby-forum.com/t/ruby-and-ejavabeans-with-rjb/103694/1 "2007-05-09T12:20:22Z")

</div>

Hi,

i’m analyzing the possibility of calling a EJB from ruby code,  
in order to fetch sets of information from remote server.

Does anyone have done this before?  
I’ m having trouble in translating the following piece fof code.

Context ctx = new InitialContext(env);  
Object narrowFromObj = ctx.lookup();  
userSessionHome = (UserSessionHome) PortableRemoteObject.narrow(  
narrowFromObj, ejbRemoteHomeClass);

to

narrowfromobj = init\_context.lookup(remoteHomeJndiName)  
portable\_remote = Rjb::import(‘javax.rmi.PortableRemoteObject’)  
portable\_remote.narrow narrowfromobj, ejbRemoteHomeClass

and i get the following error:

" method missing : Fail: unknown name ‘narrow’ (RuntimeError) "

I would be glad to resolve this issue, iÂ´m trying to integrate a RoR app  
with in j2ee environment.

Thanks!

AndrÃ©
