java
  • openldap
  • unboundid-ldap-sdk
  • 2016-03-05 146 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" 
          }; 
    
    相關問題