Posted By:
rajesh_francis
Posted On:
Thursday, March 25, 2004 03:08 AM
Please help >> What is this error ?? where my i wrong. I just want to retireve the User Name from the Active Directory using JNDI and Tomcat 3.3 Problem getting attribute: javax.naming.InvalidNameException: cn=Woods, Anthony (HQ), ou=Silverdale, ou=sews-e: [LDAP: error code 34 - 0000208F: NameErr: DSID-031001B6, problem 2006 (BAD_NAME), data 8350, best match of: 'cn=Woods, Anthony (HQ), ou=Silverdale, ou=sews-e,dc=sews-e,dc=com' ]; remaining name 'cn=Woods, Anthony , ou=Silverdale, ou=sews-e' My code try { env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://ukhqits002/dc=sews-e,dc=com"); }
More>>
Please help >> What is this error ?? where my i wrong. I just want to retireve the User Name from the Active Directory using JNDI and Tomcat 3.3
Problem getting attribute:
javax.naming.InvalidNameException: cn=Woods, Anthony (HQ), ou=Silverdale, ou=sews-e: [LDAP: error code 34 - 0000208F: NameErr: DSID-031001B6, problem 2006 (BAD_NAME), data 8350, best match of: 'cn=Woods, Anthony (HQ), ou=Silverdale, ou=sews-e,dc=sews-e,dc=com' ]; remaining name 'cn=Woods, Anthony , ou=Silverdale, ou=sews-e'
My code
try { env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://ukhqits002/dc=sews-e,dc=com");
} catch(Exception ex)
{
out.print("erroe in first para-----"+ex);
}
try {
// Create the initial directory context DirContext ctx = new InitialDirContext(env); //String userLogon = userName.substring(DOMAIN_NAME.length() +1); //System.out.println(userLogon); // Ask for all attributes of the object Attributes attrs = ctx.getAttributes("cn=francir, ou=Silverdale, ou=sews-e"); // Find the surname ("sn") and print it out.println("sn: " + attrs.get("sn").get()); // Close the context when we're done ctx.close(); } catch (NamingException e) { out.println("Problem getting attribute: " + e); }
Your advice is highly appreciated.
Rajesh
<<Less