• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about jndi and EJBLocalHome interface

 
Peter Du
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a little confused about think how jndi lookup for EJBLocalHome interface. When it's for remote home interface (EJBHome) I can think it works this way: the name server return a serializable object (the Stub) to the client, at client side the returned object deserialized, narrowed and cast to a remote interface object and client got it's reference. But for local interface, the name server is the same server and it may be a different server to the EJB container, so it should also return a serializable object when client on the EJB container invoke lookup for a local home interface object, and this object should deserialized on the EJB container and cast to a localhome interface object, if this is right, then the client will get different instance reference after each invoke of lookup, but the problem is the client should get a reference to the REAL EJBLocalHome object on the container, so there should be only one EJBLocalHome object there. Can any please explain how that works out?

Thanks
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
I'm not sure if I understood your question. But see if this post is helping you.
 
Peter Du
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Keerthi.
I'm not confused about how to use jndi to lookup a remote or local home interface object. My confuse is when compare the process it's easier to understand the process about what's going on when doing the jndi lookup for remote object.
For remote home object jndi lookup, we can conceptually think the following process happened:
1. client tell the name server where to bengin and what object he want.
2. the name server return back a serialized object
3. the client deserialized the object
4. narrow the deserialized object
5. cast
For local home jndi lookup, a similar process will be:
1. client tell the name server where to bengin and what object he want.
2. the name server return back a serialized object
3. the client deserialized the object
4. cast
The problem is in this way the client get a new object, not a reference to the exist local home object! So where the miracle happened?

Thanks.
 
Surender Kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Peter,
I have exactly the same curiosity and if you've found the answer please share it.

Thanks,
Surender
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

...for local interface, the name server is the same server and it may be a different server to the EJB container, so it should also return a serializable object when client on the EJB container invoke lookup for a local home interface object...


Nope. You cannot get a reference to a local home object outside of its JVM. Its 'local', so you need to be in the same JVM as it is.
Moreover, local home objects are not Serializable. So they cannot be transported over-the-wire to a client running in different JVM.

The container/server registers local home objects to 'its own' naming service that should be running as part of the same JVM/process.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic