Many thanks! That's a very detailed and comprehensive explanation which I
missed in many EJB books!

best regards

ZHU Jia

Dion Almaer wrote:
>
> There are a few ways to connect into JNDI via the InitialContext() method.
> You need to tell the JNDI program a few things so it knows how to connect,
> where to connect, etc.
> Since a Properties object extends the Hashtable, and the information that
> you pass in tends to be
> in the form of String's, you can use either a Properties object or a
> Hashtable.
>
> You often need to pass in the following:
>
> java.naming.factory.initial = the jndi driver class (e.g.
> weblogic.jndi.WLInitialContextFactory for BEA WebLogic)
> java.naming.provider.url    = where to find the jndi service (e.g.
> t3://www.foo.com:7001)
> java.naming.security.principal = often the username
> java.naming.security.credentials = often the password
>
> The strings above, are set as static final String's in the
> javax.naming.Context class.
>
> Context.INITIAL_CONTEXT_FACTORY = java.naming.factory.initial
> Context.PROVIDER_URL = java.naming.provider.url
> Context.SECURITY_PRINCIPAL = java.naming.security.principal
> Context.SECURITY_CREDENTIALS = java.naming.security.credentials
>
> So, in code, you can use either the strings, or the class constants.
>
> If you do not want to hard code this information, you can place the string
> information in a file named "jndi.properties"
> that is located in your CLASSPATH, or $JAVA_HOME/lib/jndi.properties, and
> just call new InitialContext() instead of new
> InitialContext(hashtable_or_properties)
>
> For example, in $JAVA_HOME/lib/jndi.properties:
>
> java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
> java.naming.provider.url=t3://www.foo.com:7001
> java.naming.security.principal=system
> java.naming.security.credentials=thepassword
>
> Hope this helps,
>
> Dion
>
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of ZHU Jia
> > Sent: Monday, April 02, 2001 1:03 AM
> > To: [EMAIL PROTECTED]
> > Subject: Different syntax of locating EJB Home Interface?
> >
> >
> > Hi,
> >
> > I just wondered why in the books/docs there are different ways of
> > locating the
> > EJB Home Interface. Some times they create a Property/Hashtable (any
> > difference?), using some quite funny looking values like
> > "Context.INITIAL_CONTEXT_FACTORY", sometimes just using
> > System.properties, and
> > sometimes even omit it at all.
> > What really is the difference? Since none of the books I've
> > really bothers to
> > explain why they chose a certain approach, I'm a bit confused here:-(
> > Many thanks for any hints!
> >
> > regard
> > ZHU Jia
> >
> > ==================================================================
> > =========
> > 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".

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