Slightly different mechanism. The client side typically gets one context
for the entire client.
The EJB container has one context per thread, which is based on what the
bean is supposed to do, which comes from the deployment/assembly
descriptor.
If bean one declares it's going to have access to resource A, bean two
wants to access resource B, then one will only see A in the JNDI context
and two will only see B. A separate thread, since it has no such
declaration will not see any resource, and will not be able to open up a
JDBC connection.
This design is based on the fact that a container will be running
multiple threads on behalf of each client. Hence the security context
which is different per thread.
On the client side, regardless of how many threads you have, you have
one client, so you tend to have one security context, one deployment
descriptor all shared between multiple threads. None issue.
arkin
dan benanav wrote:
>
> What? Then how does a client application access an ejb bean?
>
> dan
>
> Assaf Arkin wrote:
>
> > > So suppose from the main thread I create a new thread and do the above. (Get the
> > > InitialContext, etc.). Such a thread doesn't have any container-stuff either.
>So how does that
> > > work?
> >
> > It wouldn't. An EJB container can barf if you try to get InitialContext
> > outside of an EJB thread. Moreso, even if it can give you a context,
> > there's no way to tell which resources and EJBs to place in that
> > context, since the thread has no particular deployment descriptor
> > associated with it.
> >
> > If you were able to define a ThreadBean, you could provide the
> > deployment descriptor and get the JNDI ENC for that bean from that
> > thread.
> >
> > arkin
> >
> > >
> > > dan
> > >
> > > >
> > >
> > > ===========================================================================
> > > 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".
> >
> > --
> > ----------------------------------------------------------------------
> > Assaf Arkin www.exoffice.com
> > CTO, Exoffice Technologies, Inc. www.exolab.org
--
----------------------------------------------------------------------
Assaf Arkin www.exoffice.com
CTO, Exoffice Technologies, Inc. www.exolab.org
===========================================================================
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".