Spring boot SpringBoot:如何在无绑定LDAP中定义新的对象类?
在SpringBoot2.1.6项目中,我使用嵌入式LDAP服务(unboundedLDAP)。我需要定义新的属性类型和对象类。我的LDIF文件包含以下内容:Spring boot SpringBoot:如何在无绑定LDAP中定义新的对象类?,spring-boot,spring-ldap,unboundid-ldap-sdk,Spring Boot,Spring Ldap,Unboundid Ldap Sdk,在SpringBoot2.1.6项目中,我使用嵌入式LDAP服务(unboundedLDAP)。我需要定义新的属性类型和对象类。我的LDIF文件包含以下内容: dn: cn=schema changetype: modify add: attributetypes attributetypes: ( 2.25.128424792425578037463837247958458780603.1 NAME 'customAttribute' DESC 'a custom attribute' EQU
dn: cn=schema
changetype: modify
add: attributetypes
attributetypes: ( 2.25.128424792425578037463837247958458780603.1 NAME 'customAttribute' DESC 'a custom attribute' EQUALITY caseIgnoreMatch SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' )
然而,当我在tomcat上部署WAR时,我得到了以下例外:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'directoryServer' defined in class path resource [org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.unboundid.ldap.listener.InMemoryDirectoryServer]: Factory method 'directoryServer' threw exception; nested exception is java.lang.IllegalStateException: Unable to load LDIF classpath:test.ldif
...
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.unboundid.ldap.listener.InMemoryDirectoryServer]: Factory method 'directoryServer' threw exception; nested exception is java.lang.IllegalStateException: Unable to load LDIF classpath:test.ldif
...
Caused by: LDAPException(resultCode=68 (entry already exists), errorMessage='Unable to add an entry with a DN that is the same as or subordinate to the subschema subentry DN 'cn=schema'.', ldapSDKVersion=4.0.11, revision=34e39aab27ea4fb92659a6888933db08099c7e41)
at com.unboundid.ldap.listener.InMemoryRequestHandler.addEntry(InMemoryRequestHandler.java:4916)
at com.unboundid.ldap.listener.InMemoryRequestHandler.importFromLDIF(InMemoryRequestHandler.java:4624)
at com.unboundid.ldap.listener.InMemoryDirectoryServer.importFromLDIF(InMemoryDirectoryServer.java:1255)
at org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration.importLdif(EmbeddedLdapAutoConfiguration.java:164)
... 76 more
显然,由于某种原因,LDAP服务“认为”我正在尝试添加条目“cn=schema”,并拒绝该操作,因为该条目已经存在,而我正在尝试修改它,因此LDIF文件中的状态为“changetype:modify”
有人能告诉我我做错了什么吗
非常感谢
亲切问候,
尼古拉斯