wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes how a client locates a server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "how a client locates a server" Watch "how a client locates a server" New topic
Author

how a client locates a server

Lee Ming
Greenhorn

Joined: Dec 15, 2003
Posts: 16
Hi,
I do not have EJB experience in real business, but I have run some examples EJB application in Sun's J2EE RI, it works well!
All the examples I found lookup a remote home from a client like this:

I think the examples work well since I run the J2EE server and the EJB client on the same computer, but what happen if the client and the J2EE server are not on the same computer ?
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Lee,
I think the examples work well since I run the J2EE server and the EJB client on the same computer, but what happen if the client and the J2EE server are not on the same computer ?

Nothing special, because EJB offers network transparency :
"A client using the remote home and remote interfaces can reside on a different
machine than the enterprise bean (location transparency), and the object references of the remote home
and remote interfaces can be passed over the network to other applications." (EJB specs p. 385)
Best,
Phil.
Magnus Stattin
Ranch Hand

Joined: Jun 05, 2003
Posts: 65
Even though EJB offers location transparancy I think that you have to tell the client where to find the server that runs the JNDI service. In this case you include information for where the JNDI service is located. How this is done is specific for a particular container so it will not be on the exam.
For example this is how it is done i Weblogic:
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY ,"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, "t3://localhost:7001");

Context initialContext = new InitialContext(properties);

Phillipe
It's very nice to see that you are still with us in the forum even after you passed the exam so gracefully.
/Best Regards
Magnus
[ December 18, 2003: Message edited by: Magnus Stattin ]
[ December 18, 2003: Message edited by: Magnus Stattin ]
Lee Ming
Greenhorn

Joined: Dec 15, 2003
Posts: 16
Thanks Philippe, actually, the server is location transparent to the client code, but not the client computer, the deployer of the client container should need to know where the server is(spec 401)!
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Magnus and Lee,
Phillipe
It's very nice to see that you are still with us in the forum even after you passed the exam so gracefully.

Thank you., you're welcome . Now keeping around here is the best way I found out to not forget everything I just learned, ... and to go on with learning new stuff as I just did thanks to your posts.
Best,
Phil.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how a client locates a server