Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how a client locates a server

 
Lee Ming
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1872
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1872
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic