I follow the tutorial: https://docs.oracle.com/javase/tutorial/jndi/index.html
My adventures began when I set the JNDI name for the data source from the WildFly application server. The name began with "java: /". I was curious what it was and how it worked.
I have a local Apache LDAP server and I can connect to it using
Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:10389/o=JNDITutorial");
env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");
try {
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("cn=Rosanna Lee,ou=People");
} catch (NamingException e) {
e.printStackTrace();
}
My confusion is the JNDI name "java: /".
Can someone explain what “java: /” is and how can I use JNDI to interact with it?
My guess is its directory, located somewhere on my computer.
Thank.
Brian source
share