These are not exclusive, they are both required:
 
 Context context = new InitialContext();
 MyHome mh = (MyHome)javax.rmi.PortableRemoteObject.narrow(
context.lookup("HomeName"), MyHome.class);

It used to be permissible to just do
 
MyHome th = (MyHome)context.lookup("HomeName");
 
but the advent of RMI-IIOP made this extra narrowing step necessary. You may
find that EJB servers that do not use RMI over IIOP will work with the old
(brief) method, but protect yourself by using the narrowing step for all
remote objects as well.


Dave Smith 
Senior Team Leader 
Aristocrat Technologies Australia Pty Ltd 

mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 27 July 2000 7:05
To: Orion-Interest
Subject: Getting remote objects



After reading volumes of information on EJB's, I am a bit confused as to
what is the preferred method for obtaining a reference to an EJB from the
client.  I see 2 styles of doing this.  One involves casting to the Home
interface by doing a 'Context.lookup(String jndi_name)', while the other is
by using PortableRemoteObject.narrow(...).   Is there any benefit to either
one?  I prefer the former, since the syntax seems much cleaner, but what's
the bottom line? 

Also, what are the core set of Orion-specific .jars that must be distributed
to a client when using orionserver? 

Thanks, 
-Jason


Reply via email to