wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Question about default constructor for InitialContext()... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Question about default constructor for InitialContext()... " Watch "Question about default constructor for InitialContext()... " New topic
Author

Question about default constructor for InitialContext()...

SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
If an application server is listening on port 7001, and lets say a servlet running on the app server wants to find a resource in the app server using JNDI, is it possible to use an InitialContext object without initializing it with the CONTEXT_FACTORY ans PROVIDER_URL parameters?
Can I just use:
InitialContext()
...instead of:
InitialContext ctx = null;
Hashtable h = new Hashtable();
h.put( Context.INITIAL_CONTEXT_FACTORY, "factoryname");
h.put( Context.PROVIDER_URL, "url");
InitialContext( h);
SAF
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
Forget it. I ran a small driver and tested this out myself. It seems that InitialContext() without any initialization paramter always defaults to the local machine, and it also finds the listening port of the application server by some sort of magic I'm assuming .
SAF
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about default constructor for InitialContext()...