Hi Anamitra,

The following explains the containers so called magic.

========================== extracted from java docs
=====================================================

When the initial context is constructed, its environment is initialized with
properties defined in the environment parameter passed to the constructor,
and in any application resource files. In addition, a small number of
standard JNDI properties may be specified as system properties or as applet
parameters (through the use of Context.APPLET). These special properties are
listed in the field detail sections of the Context and LdapContext interface
documentation.

JNDI determines each property's value by merging the values from the
following two sources, in order:

The first occurrence of the property from the constructor's environment
parameter and (for appropriate properties) the applet parameters and system
properties.
The application resource files (jndi.properties).
For each property found in both of these two sources, or in more than one
application resource file, the property's value is determined as follows. If
the property is one of the standard JNDI properties that specify a list of
JNDI factories (see Context), all of the values are concatenated into a
single colon-separated list. For other properties, only the first value
found is used.
The initial context implementation is determined at runtime. The default
policy uses the environment property "java.naming.factory.initial", which
contains the class name of the initial context factory. An exception to this
policy is made when resolving URL strings, as described below.

When a URL string (a String of the form scheme_id:rest_of_name) is passed as
a name parameter to any method, a URL context factory for handling that
scheme is located and used to resolve the URL. If no such factory is found,
the initial context specified by "java.naming.factory.initial" is used.
Similarly, when a CompositeName object whose first component is a URL string
is passed as a name parameter to any method, a URL context factory is
located and used to resolve the first name component. See
NamingManager.getURLContext() for a description of how URL context factories
are located.

This default policy of locating the initial context and URL context
factories may be overridden by calling
NamingManager.setInitialContextFactoryBuilder().

NoInitialContextException is thrown when an initial context cannot be
instantiated. This exception can be thrown during any interaction with the
InitialContext, not only when the InitialContext is constructed. For
example, the implementation of the initial context might lazily retrieve the
context only when actual methods are invoked on it. The application should
not have any dependency on when the existence of an initial context is
determined.

When the environment property "java.naming.factory.initial" is non-null, the
InitialContext constructor will attempt to create the initial context
specified therein. At that time, the initial context factory involved might
throw an exception if a problem is encountered. However, it is provider
implementation-dependent when it verifies and indicates to the users of the
initial context any environment property- or connection- related problems.
It can do so lazily--delaying until an operation is performed on the
context, or eagerly, at the time the context is constructed.

============================================================================
================================================

http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/InitialContext.ht
ml

I believe that some containers do not support this release of jndi. So you
might still run into problems both on the client and server.

kind regards,

William Louth

> -----Original Message-----
> From: Bhattacharyya, Ana [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, April 05, 2000 2:11 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Jndi in EJB
>
> in ejb the registration of beans is done through jndi --- it  is done by
> the
> conatiner and is transparent to the programmer. the name correspoding to
> which ur object gets bound to the name service is supplied by u in the
> DDs.
> and in ejb 1.1 all resource like datasource etc are supposed to be taken
> from the name service --- so the following code
> InitialContext ic = new InitialContext();
> DataSource ds = (DataSource) ic.lookup(dbName);
> HTH
> Anamitra
>
> -----Original Message-----
> From: Telmo S� [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 05, 2000 8:56 AM
> To: [EMAIL PROTECTED]
> Subject: Jndi in EJB
>
>
> Hello all!
> I would like to know how does the name registration works in EJB.
> I have been looking to the AccountEJB example from the j2eeri and the only
> thing that is done there is:
>
> InitialContext ic = new InitialContext();
> DataSource ds = (DataSource) ic.lookup(dbName);
>
> In the JNDI tuturial examples they always set a factory and the reach out
> the service provider.
> In EJB things seem to happen magically, so to speek!!
>
> Thank you for any lights on the matter.
>
>   Telmo
>
> ==========================================================================
> =
> 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".


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

===========================================================================
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".

Reply via email to