Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
ht.put(Context.SECURITY_AUTHENTICATION,"simple");
ht.put(Context.PROVIDER_URL, "ldap://IP:port");
ht.put(Context.SECURITY_PRINCIPAL, "用户名");
ht.put(Context.SECURITY_CREDENTIALS, "密码");
DirContent ctx=new InitialDirContext(ht);
ht.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
ht.put(Context.SECURITY_AUTHENTICATION,"simple");
ht.put(Context.PROVIDER_URL, "ldap://IP:port");
ht.put(Context.SECURITY_PRINCIPAL, "用户名");
ht.put(Context.SECURITY_CREDENTIALS, "密码");
DirContent ctx=new InitialDirContext(ht);
env.put(Context.SECURITY_PROTOCOL,"ssl");
env.put("com.sun.jndi.ldap.trace.ber", System.out);这两句是什么意思
javax.naming.CommunicationException: ipsapro.isoftstone.com:389 [Root exception is java.net.ConnectException: Connection refused: connect]
java.lang.NullPointerException
还有一点! 我要制定用ssl; 是不是要
加上
env.put(Context.SECURITY_PROTOCOL,"ssl");
env.put("com.sun.jndi.ldap.trace.ber", System.out);