tags:

views:

21

answers:

1

Hi ,

After I do a JNDI look up , what I get is a reference to the Home of EJB Object. But when I do an API call on Home/Remote , how does it find the URL/port of the server ?

Thanks J

A: 

RMI makes this possible. The local objects you get on the client side are called stubs and know how to look over the network for their remote counterpart through RMI/IIOP. Quoting Understanding Java RMI Internals:

The client has NO idea on which machine and to which port the server is listening. But, it has a stub object that knows all these. So, the client can invoke the desired method of the stub.

I also suggest to check this very nice article (a bit old but still nice) on TheServerSide: Under the Hood of J2EE Clustering (starting from EJB clustering implementation). It covers more than your initial question but is very interesting.

Pascal Thivent