"Bono, Chris" wrote:
> Sven,
> Specifying the properties in the constructor of InitialContext is portable
> and necessary in cases when you are looking up a jndi resource from another
> machine.
There is no rule in JNDI that says a context cannot contain references to resources in
multiple machines - local-remote transparency is provided for - though it might be
hard/impossible to set up for a given implementation.
> The no-args constructor will get you the context of the appserver
> you are running under.
Strictly speaking it's the context set up by the app server for this EJB - different
EJBs can have a different one.
> However if you needed to lookup a jndi resource on
> another machine, or you are a stand-alone client app that needs to lookup
> a jndi resource (such as an EJBHome), you will have to tell jndi what implementation
> to use and the location of the resource. (Context.INITIAL_CONTEXT_FACTORY and
> Context.PROVIDER_URL, respectively).
The point is that as well as portability, the INTENT of J2EE is that each EJB's context
can be different so as to permit, for example, a production and a test version of the
same EJB to automatically access production or test resources and to enable beans to be
moved about from machine to machine without affecting their clients.
I do think that app server implementations often fall short though.
cheers... Ian
Ian McCallion
Alexis Systems Limited
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".