Robert Nicholson wrote:
> This practice is usually recommended in many containers. I'd like to know if
> it's some kind of hint in order to do jndi lookups in the same VM.
>
Not only. It provides an additional indirection, enabling the two components to
be more independent., and not to hardcode the actual JNDI name in the bean code,
but just a link to this name. If ejb-link is used, it informs the container that
the two beans are colocated, which can greatly imrove the performance by not
doing remote calls for inter-beans lookups.
>
> ie. an external client uses MyBean where as a bean uses java: ....
>
In fact, even external clients, if they use a J2EE-compatible client container,
should use the java:comp context to lookup beans. Look at the J2EE
specifications.
JB.
>
> Is this simply so the container can use the information as a hint to
> optomize the lookup and consequently know that it's a local object acting as
> the client? Do containers optomize this despite location transparency? I'm
> pretty sure the stub is different when it's a intra container message right?
>
> Why is there this inconsistency? I'm reading WROX Java Server Programmer
> J2EE edition and in there they use the above approach in the ejb chapters.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Manne
> > Fagerlind
> > Sent: Monday, March 12, 2001 9:13 AM
> > To: Orion-Interest
> > Subject: RE: Inconsistent EJB JNDI Locations
> >
> >
> > I used the JNDI name "java:comp/env/ejb/MyBean" yesterday and it
> > worked fine
> > (older version of Orion; hope they haven't changed it). It seems that the
> > object performing the lookup must be located inside the same enterprise
> > application (i.e. <application>-entry in server.xml) for this to work,
> > though.
> >
> > /Manne
> >
> > -----Original Message-----
> > From: Gary Shea [mailto:[EMAIL PROTECTED]]
> > Sent: 09 March 2001 20:57
> > To: [EMAIL PROTECTED]
> > Subject: Re: Inconsistent EJB JNDI Locations
> >
> >
> > On Thu, 8 Mar 2001, Peter Pontbriand wrote:
> > > Yes, this is what works for us. Assuming that the Entity EJB is deployed
> > > with <ejb-name>MyBean</ejb-name> and that the Session EJB's deployment
> > > descriptor has an <ejb-ref-name>ejb/MyBean</ejb-ref-name>, the home
> > > interface for MyBean is supposed to be found with
> > > 'lookup("java:comp/env/ejb/MyBean")'. Unfortunately, this doesn't work,
> > but
> > > rather MyBean is found with 'lookup("MyBean")'.
> >
> > Recently I was looking at the spec while trying to figure out why
> > Orion's JNDI setup isn't like the examples in the EJB books. Turns
> > out that the java:comp/env/{jms,ejb,...} locations are 'recommended',
> > not mandatory. Given that the non-Context contents of the env/
> > directory must be String objects, it doesn't surprise me that the
> > Orion folks decided it was tacky to put objects underneath a
> > directory that's supposed to hold strings. Also, I noticed when
> > attempting to create objects below the env/ directory using the
> > JNDI api, they somehow get turned into strings! I'm a little unclear
> > on whether this really happened or if I was doing something stupid,
> > but it's what I think I saw!
> >
> > Cheers,
> >
> > Gary
> >
> >
> >
> >
>
> ===========================================================================
> 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".
===========================================================================
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".