Posted By:
Pramod_Mirji
Posted On:
Sunday, February 3, 2002 10:20 PM
Hi All, I am using iPlanet Directory Server 5.1, I just installed the diectory server and I am trying to get attributes for user, My code looks like this, Hashtable env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://localhost:389"); try { // Create the initial directory context DirContext ctx = new InitialDirContext(env); // Ask for all attributes of the object Attributes attrs = ctx.getAttributes("cn=Pramod Mirji,ou=people"); // Find the surname ("sn") and print i
More>>
Hi All,
I am using iPlanet Directory Server 5.1, I just installed the diectory server and I am trying to get attributes for user, My code looks like this,
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389");
try {
// Create the initial directory context
DirContext ctx = new InitialDirContext(env);
// Ask for all attributes of the object
Attributes attrs = ctx.getAttributes("cn=Pramod Mirji,ou=people");
// Find the surname ("sn") and print it
System.out.println("sn: " + attrs.get("sn").get());
// Close the context when we're done
ctx.close();
} catch (NamingException e) {
System.err.println("Problem getting attribute: " + e);
}
when I execute this program I am getting following exception,
problem getting attribute: javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]
remaining name 'cn=Pramod Mirji,ou=people'
can anybody help me ........
or give me an example code which does similar thing....
Thanks,
Pramod
<<Less