srikotesh
asked on
javax.naming.AuthenticationException
Hi Expets,
I am trying to connect ldap active directory path
Exception:
==========
Exception in thread "main" javax.naming.Authenticatio nException :
[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903CF,
comment: AcceptSecurityContext error, data 52e, v2580
PLEASE FINE THE BELOW CODE AND SUGGEST WHAT IS WRONG IN MY CODE
I am trying to connect ldap active directory path
Exception:
==========
Exception in thread "main" javax.naming.Authenticatio
[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903CF,
comment: AcceptSecurityContext error, data 52e, v2580
PLEASE FINE THE BELOW CODE AND SUGGEST WHAT IS WRONG IN MY CODE
public class AdSearchExample {
/**
* @param args
* @return
* @throws NamingException
*/
public static InitialDirContext getDirContext() throws NamingException {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,"ldap://host:portno/");
env.put(Context.REFERRAL, "follow");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "CN=SRI RAO,OU=PRAC,OU=Users,OU=MindTree Bangalore,OU=Asia Pacific,DC=mindtree,DC=com");
env.put(Context.SECURITY_CREDENTIALS, "welocome@123");
System.out.println("env" +env);
return new InitialDirContext(env);
}
public static void main(String args[]) throws NamingException{
DirContext context = getDirContext();
}
}
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.