日期:2014-05-20  浏览次数:20962 次

LDAP客户端绑定账户报错,有做过的帮忙看下
代码
Java code

LDAPConnection lc = new LDAPConnection();       
           try {       
               lc.connect("bb.bb.com",389);
               System.out.println("1111111"); 
          
               lc.bind(LDAPConnection.LDAP_V3,"CN=Test,OU=BBM,O=BBRA","123456789");
//这里报错
               System.out.println("22222222"); 
               LDAPSearchResults rs = lc.search("CN=Test,OU=BBM,O=BBRA,"objectClass=dominoPerson",null,false);       
               int count = 0;       
               while(rs.hasMore()){       
                   LDAPEntry entry = rs.next();       
                   System.out.println(entry.getDN());       
                   count++;       
               }       
               System.out.println("共有"+count+"条记录。");       
           } catch (LDAPException e) {       
                     
               System.err.print("连接异常!   ");       
               e.printStackTrace();       
           }



错误信息
连接异常! LDAPException: Invalid Credentials (49) Invalid Credentials
LDAPException: Server Message: Failed, invalid credentials for CN=Test,OU=BBM,O=BBRA
LDAPException: Matched DN: 
at com.novell.ldap.LDAPResponse.getResultException(Unknown Source)
at com.novell.ldap.LDAPResponse.chkResultCode(Unknown Source)
at com.novell.ldap.LDAPConnection.chkResultCode(Unknown Source)
at com.novell.ldap.LDAPConnection.bind(Unknown Source)
at com.novell.ldap.LDAPConnection.bind(Unknown Source)

把密码改为空匿名登录又可以

------解决方案--------------------
确定不是Test的密码错误的问题?除此之外只能帮你顶了。。。
------解决方案--------------------
看是不是这里列出的情况

http://stackoverflow.com/questions/7193991/ldapexception-invalid-credentials-49-invalid-credentials-with-grails

host文件中放入的url相关