0

I am struggling to understand what InitialContext does. I understand that it provides initial context to lookup objects, but which server does it lookup?

I know that we can pass the server url as one of the properties for Context, but "generally" the InitialContext is called without parameters. In that "general" case which server it does lookup?

Sandeep Jindal
  • 14,510
  • 18
  • 83
  • 121

1 Answers1

0

If you are constructing the InitialContext from within a application which is hosted in a server (web/app servers), then it defaults to the Initial Context and the port of the hosted server.

In order words, your lookup object is also bound to the JNDI tree of the server that your calling application is deployed.

Arun Manivannan
  • 4,213
  • 3
  • 29
  • 38
  • No it doesn't. There is no such thing as 'the InitialContext ... of the hosted server'. If you're in a servlet container it defaults to an internal JNDI namespace that doesn't have a port or a TCP aspect to at all, just an ObjectFactory. If you're not in a servlet container it doesn't default at all. – user207421 Sep 09 '12 at 01:32