package mypack;
import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class ADCheck {
public static void main(String[] args) {
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,"LDAP://myad.com:385");
env.put(Context.SECURITY_AUTHENTICATION,"DIGEST-MD5");
env.put(Context.SECURITY_PRINCIPAL,"MY_USER_NAME");
env.put(Context.SECURITY_CREDENTIALS, "MY_PASSWORS");
DirContext ctx = new InitialDirContext(env);
ctx.close();
} catch(NamingException ne) {
System.out.println("Error authenticating user:");
System.out.println(ne.getMessage());
return;
}
System.out.println("OK, successfully authenticating user");
}
}
得到错误:
javax.naming.AuthenticationException:[LDAP:错误代码 49 - 8009030C:LdapErr:DSID-0C09043E,注释:AcceptSecurityContext 错误,数据 0,vece。
请帮忙