you can only call (1) from the same vm as the JNDI is running. Eg calling
from an EJB, or servlet. This is because your app server loads the JNDI
properites from the system runtime automatically.

You would use (2) in an external client that accesses your app server. This
is a different VM

-----Original Message-----
From: Rhodes, Phillip C. [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 06, 2000 1:59 PM
To: [EMAIL PROTECTED]
Subject: So many means to get Context?


I am confused as to why I would choose a way to get an initial context.
Anyone know of a document that explains why we would choose one way vs.
another?
Thanks, and sorry if this is a stupid question!

For example,
1)
InitialContext context = new InitialContext();
Object obj = context.lookup("java:comp/env/ejb/Category");
CategoryHome ch = (CategoryHome)PortableRemoteObject.narrow(obj,
CategoryHome.class);
2)
final Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"allaire.ejipt.ContextFactory");
...//set rest of props
Context initCtx = new InitialContext(properties);
3)  Deprecated!
Context initCtx = new InitialContext(properties);
Context initCtx = new InitialContext(ctx.getEnvironment());
home = (shopping.CategoryHome) initCtx.lookup("shopping.CategoryHome");




Phillip Rhodes
[EMAIL PROTECTED]
Alcoa eCommerce
https://www.ALCOADIRECT.COM
826B Two Allegheny Center Pittsburgh, PA  15212
(412) 553-4900  (phone)  (412) 553-2484 (fax)

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