java
  • openldap
  • unboundid-ldap-sdk
  • 2016-03-05 140 views 0 likes 
    0

    我试图向ldap中添加一个新条目。我使用unboundid ldap sdk我能够成功连接然而,LDAP,当我尝试添加新条目,我收到以下错误:使用unboundid ldap sdk在openldap服务器中添加条目

    Exception in thread "main" LDAPException(resultCode=undefined attribute type, errorMessage='changetype: attribute type undefined') 
    at com.unboundid.ldap.sdk.LDAPConnection.add(LDAPConnection.java:1539) 
    

    这里是我用来添加进入LDAP代码片段:

    String[] ldifAttrs = { 
          "dn: ou=people,dc=maxcrc,dc=com", 
          "changetype:add", 
          "cn: vipin", 
          "sn: falke", 
          "uid: vfalke", 
          "userPassword:secret" 
          }; 
    LDAPConnection ldapConnection = new LDAPConnection("127.0.0.1", 389, 
          "cn=Manager, dc=maxcrc, dc=com", "secret"); 
    ldapConnection.add(new AddRequest(ldifAttrs)); 
    

    LDAP服务器的目录结构:enter image description here

    请让我什么我做错了。

    谢谢

    回答

    0

    我想你会需要添加,至少”一些,我建议所有,如果不是所有的对象类。

    否则怎么会OpenLDAP的知道你想添加什么类型的对象类的.adding?

    String[] ldifAttrs = { 
          "dn: ou=people,dc=maxcrc,dc=com", 
          "changetype:add", 
          "objectClass: top", 
          "objectClass: person", 
          "objectClass: organizationalPerson", 
          "objectClass: inetOrgPerson", 
          "cn: vipin", 
          "sn: falke", 
          "uid: vfalke", 
          "userPassword:secret" 
          }; 
    
    相关问题