aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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()...
 
Similar Threads
Ejb lookup on a diff server
Problem in accessing EJB from application client
JNDI
lookup on UserTransaction
Naming Exception 'Unable to resolve ...'