users@glassfish.java.net

Re: Simple (?) questions about context lookups

From: Sahoo <sahoo_at_sun.com>
Date: Tue, 20 Jan 2009 10:53:24 +0530

glassfish_at_javadesktop.org wrote:
> When using JNDI lookups like [b](new InitialContext()).lookup("java:/comp/env/jdbc/datasource")[/b], does the name refer to a global object or is to something within the bean's descriptor (since that is where I have seen the value specified)?
>
something within the bean's descriptor. java:/comp/env is special in
that case; it always refers to calling component's context.
> In other words, if I deploy 2 instances of the same bean in different EARs and with their own deployment descriptor settings, does each instance get the value from its own descriptor?
>
Yes.
> And for bonus points (:-), can you specify it once only for all instances [just curious, that's not what I want to do]?
>
You can look up using the global JNDI name that you have used while
creating the JDBC resource while using the admin gui or admin cli.
> And is the new EJBContext.lookup() method different in this regard?
>
No.

Sahoo