Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java LDAP用户注册提供了;“没有全球卓越的知识”;根据.ldif文件定义DN时出错_Java_Spring Boot_Ldap_Openldap_Spring Ldap - Fatal编程技术网

Java LDAP用户注册提供了;“没有全球卓越的知识”;根据.ldif文件定义DN时出错

Java LDAP用户注册提供了;“没有全球卓越的知识”;根据.ldif文件定义DN时出错,java,spring-boot,ldap,openldap,spring-ldap,Java,Spring Boot,Ldap,Openldap,Spring Ldap,我使用LDAP进行用户管理,并使用SpringBootLDAP对其进行了配置。用户登录(身份验证)工作正常,现在,我正在尝试注册一个新用户,并使用ldapTemplate.bind()方法在LDAP中插入一个条目 注册 public String create(UserResponsePojo userResponsePojo) { try { Name dn = LdapNameBuilder .newIn

我使用LDAP进行用户管理,并使用SpringBootLDAP对其进行了配置。用户登录(身份验证)工作正常,现在,我正在尝试注册一个新用户,并使用ldapTemplate.bind()方法在LDAP中插入一个条目

注册

public String create(UserResponsePojo userResponsePojo) {
        try {
              Name dn = LdapNameBuilder
                      .newInstance()
                      .add("o", "company")
                      .add("ou", "department")
                      .build();

                    DirContextAdapter context = new DirContextAdapter();
                    context.setDn(dn);
                    context.setAttributeValues("objectclass", new String[]{"top", "person", "inetOrgPerson"});
                    context.setAttributeValue("cn", userResponsePojo.getUsername());
                    context.setAttributeValue("sn", userResponsePojo.getLastname());
                    context.setAttributeValue("description", userResponsePojo.getUserrole());
                    context.setAttributeValue("mail", userResponsePojo.getUid());
                    context.setAttributeValue("userPassword", userResponsePojo.getPassword());

                    ldapTemplate.bind(context);

                    return "success";
                } catch (Exception e) {
                    e.printStackTrace();
                    return "failed";
                }   
    }
ldif文件

# id=00000001
dn: o=company
objectClass: organization
structuralObjectClass: organization
o: company
entryCSN: 20130409162114.626166Z#000000#000#000000
entryUUID: 3e7f8668-357d-1032-8a6b-c5bcf7f703f0
creatorsName: cn=Manager,o=company
createTimestamp: 20130409162114Z
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130409162114Z
contextCSN: 20130702105648.506150Z#000000#000#000000
contextCSN: 20191018052018.692119Z#000000#001#000000
contextCSN: 20191018044350.858888Z#000000#002#000000
contextCSN: 20191018053729.621549Z#000000#003#000000

# id=00000002
dn: ou=department,o=company
objectClass: organizationalUnit
structuralObjectClass: organizationalUnit
ou: department
entryCSN: 20130409162455.623488Z#000000#000#000000
entryUUID: c2390a06-357d-1032-8a6c-c5bcf7f703f0
creatorsName: cn=Manager,o=company
createTimestamp: 20130409162455Z
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130409162455Z

# id=00000003
dn: mail=abc@gmail.com,ou=department,o=company
businessCategory: unset
sn: unset
userPassword:: e1NTSEF9RTFoVUNEM1pPc3RBQ2g4ZHWlVDTk80QWN6ajk3aHFC
mail: abc@gmail.com
objectClass: top
objectClass: person
objectClass: inetOrgPerson
structuralObjectClass: inetOrgPerson
entryUUID: 842a22b0-a8c6-1032-9ba8-e1e428e5443b
creatorsName: cn=Manager,o=company
createTimestamp: 20130903092528Z
cn: abc
description: Member
entryCSN: 20130903092528.695993Z#000000#000#000000
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130903092528Z

# id=00000004
dn: mail=xyz@gmail.com,ou=department,o=company
uid: unset
mail: xyz@gmail.com
sn: unset
userPassword:: e1NTSEF9OXU3aEFVQkthdZMb284ZWQrNkthdUtrN1NDUnAraDFU
objectClass: top
objectClass: person
objectClass: inetOrgPerson
structuralObjectClass: inetOrgPerson
entryUUID: eafcbd14-a8ca-1032-9bac-e1e428e5443b
creatorsName: cn=Manager,o=company
createTimestamp: 20130903095658Z
cn: xyz
description: Member
businessCategory: e-Governance
entryCSN: 20130927145536.344831Z#000000#000#000000
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130927145536Z
org.springframework.ldap.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; nested exception is javax.naming.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; remaining name 'ou=department,o=company'
当调用ldapTemplate.bind()时,它抛出错误LDAP:error code 53-无全局高级知识

# id=00000001
dn: o=company
objectClass: organization
structuralObjectClass: organization
o: company
entryCSN: 20130409162114.626166Z#000000#000#000000
entryUUID: 3e7f8668-357d-1032-8a6b-c5bcf7f703f0
creatorsName: cn=Manager,o=company
createTimestamp: 20130409162114Z
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130409162114Z
contextCSN: 20130702105648.506150Z#000000#000#000000
contextCSN: 20191018052018.692119Z#000000#001#000000
contextCSN: 20191018044350.858888Z#000000#002#000000
contextCSN: 20191018053729.621549Z#000000#003#000000

# id=00000002
dn: ou=department,o=company
objectClass: organizationalUnit
structuralObjectClass: organizationalUnit
ou: department
entryCSN: 20130409162455.623488Z#000000#000#000000
entryUUID: c2390a06-357d-1032-8a6c-c5bcf7f703f0
creatorsName: cn=Manager,o=company
createTimestamp: 20130409162455Z
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130409162455Z

# id=00000003
dn: mail=abc@gmail.com,ou=department,o=company
businessCategory: unset
sn: unset
userPassword:: e1NTSEF9RTFoVUNEM1pPc3RBQ2g4ZHWlVDTk80QWN6ajk3aHFC
mail: abc@gmail.com
objectClass: top
objectClass: person
objectClass: inetOrgPerson
structuralObjectClass: inetOrgPerson
entryUUID: 842a22b0-a8c6-1032-9ba8-e1e428e5443b
creatorsName: cn=Manager,o=company
createTimestamp: 20130903092528Z
cn: abc
description: Member
entryCSN: 20130903092528.695993Z#000000#000#000000
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130903092528Z

# id=00000004
dn: mail=xyz@gmail.com,ou=department,o=company
uid: unset
mail: xyz@gmail.com
sn: unset
userPassword:: e1NTSEF9OXU3aEFVQkthdZMb284ZWQrNkthdUtrN1NDUnAraDFU
objectClass: top
objectClass: person
objectClass: inetOrgPerson
structuralObjectClass: inetOrgPerson
entryUUID: eafcbd14-a8ca-1032-9bac-e1e428e5443b
creatorsName: cn=Manager,o=company
createTimestamp: 20130903095658Z
cn: xyz
description: Member
businessCategory: e-Governance
entryCSN: 20130927145536.344831Z#000000#000#000000
modifiersName: cn=Manager,o=company
modifyTimestamp: 20130927145536Z
org.springframework.ldap.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; nested exception is javax.naming.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; remaining name 'ou=department,o=company'
我在web上搜索解决方案,发现当我们尝试在ldif文件中不可用的某个目录中插入用户时,会发生此错误,但正如我所看到的,我尝试使用ldif文件中也可用的同一目录。 我尝试了许多DN组合,但没有得到所需的解决方案。请引导我通过这个。
提前谢谢

`Name dn=LdapNameBuilder.newInstance().add(“o”,“company”).add(“ou”,“department”).build();`创建一个DN“ou=department,o=company”,但我猜您希望创建一个带有“mail=VALUE,ou=department,o=company”的条目。是的,我想创建一个带有“mail=VALUE,ou=department,o=company”的新条目,这就是为什么我还提供了名称DN=LdapNameBuilder.newInstance()。添加(“o”,“company”)。添加(“ou”,“department”)。添加(“mail”,“VALUE”)。build(); 也但我仍然得到了相同的错误“没有全局高级知识”似乎是OpenLDAP目录服务器的错误。当您尝试通过“ldapmodify”添加条目时,它是否起作用?我尝试了
ldapadd-x-D“cn=Manager,o=company”-W-f test1.ldif
通过命令行插入数据,并成功执行了该操作,但当我尝试使用JAVA代码时,每次都会引发相同的异常。