异常-重新启动ldap服务器后,java访问ldap服务器
我还有一个问题,我从LDAP获取一个上下文,为InitialContext设置JNDI环境属性,如下所示。 然后重新启动ldap服务器,每次尝试再次获取InitialContext时,都会引发下一个异常 获取上下文的代码异常-重新启动ldap服务器后,java访问ldap服务器,ldap,bea,Ldap,Bea,我还有一个问题,我从LDAP获取一个上下文,为InitialContext设置JNDI环境属性,如下所示。 然后重新启动ldap服务器,每次尝试再次获取InitialContext时,都会引发下一个异常 获取上下文的代码 Context ctx = null; Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContext
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
ht.put(Context.SECURITY_PRINCIPAL,"USER1");
ht.put(Context.CREDENTIALS,"PASSWORD1");
try {
ctx = new InitialContext(ht);
}
catch (NamingException e) {
}
finally {
try {ctx.close();
}
catch (Exception e) {
// a failure occurred
}
}
例外情况:
java.security.PrivilegedActionException: javax.naming.ConfigurationException: Call to NamingManager.getObjectInstance() failed:
[Root exception is java.lang.SecurityException:
[Security:090398]Invalid Subject: principals=[ADMIN]]; remaining name ''
BEA-090398
您没有提供正确的DN进行身份验证:
ht.put(Context.SECURITY_PRINCIPAL,“USER1”)代码>
您应该有cn=user1、ou=something、dc=something、dc=com之类的