Spring LDAP连接异常解决

在整理spring LDAP时发现一直报如下异常

private static final LdapTemplate template;

static {
        LdapContextSource cs = new LdapContextSource();
        cs.setUrl("ldap://172.18.254.210:389");
        cs.setBase("DC=hans,DC=com");
        cs.setUserDn("[email protected]");//账号
        cs.setPassword("123456");//密码
        cs.afterPropertiesSet();//异常就是此处未设置造成的
        template = new LdapTemplate(cs);


Spring LDAP连接异常解决_第1张图片


此异常基本上就是账号密码错误导致的,检查账号密码是否正确

Spring LDAP连接异常解决_第2张图片

你可能感兴趣的:(Spring,Ldap)