File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Help with InitialContext!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help with InitialContext!!" Watch "Help with InitialContext!!" New topic

Help with InitialContext!!

Saiprasad Natarajan

Joined: Oct 27, 2010
Posts: 12


Does InitialContext() initialize a context to the server where the calling application is deployed?

And if i need the JNDI look up to happen at the current server itself, would new InitialContext() suffice or do i need to specify the environment also?

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

InitialContext always needs the properties to be set, but if you look at the javax.naming.Context API there are multiple ways to specify these properties.
You can define them explicitly and pass them to the constructor, otherwise (as in your case) the default values can be defined as environent variables or as a resource file (on the file system)
I agree. Here's the link:
subject: Help with InitialContext!!
It's not a secret anymore!