JNDI is like a map on steroids right? I use a key to find references to objects.
Also, what is InitialContext? I don’t seem to get the idea.
JNDI is like a map on steroids right? I use a key to find
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Conceptually, JNDI is like
System.getProperties()on steroids.System.getProperties()allows you to passStringparameters to your code from the command line. Similarly, JNDI allows you to configure arbitrary objects outside of your code (for example, in application server config files) and then use them in your code.In other words, it’s an implementation of Service Locator pattern: your code obtains services configured by environment from the centeral registry.
As usually with Service Locators, your code should have some entry point to access Service Locator.
InitialContextis this entry point: you createInitialContextand then obtain required services from JNDI withlookup().