Hi, I am a bit lost here. "You can have both a Remote and local client view for a bean". To get a reference to a home clients does something like and than has to either narrow-cast or cast to EJBHome or EJBLocalHome. How does container know what type of home the client needs? Thanks
The container doesn't know, but the client *does* know if it is a local or remote client. You would have the local home bound to one JNDI name, and the remote client bound to another name. The client then uses the JNDI name that will get it an appropriate home.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
A couple of other things to keep in mind: - You don't generally access local interfaces via JNDI in the way you've shown. You usually get them via the environment naming context (what HFE calls 'the bean's special JNDI context'. - You can cast a local interface via a simple Java cast. Remote interfaces obtained via JNDI or from a handle need to be narrowed, i.e. PortableRemoteObject.narrow(...).