我正在尝试向目录服务器数据库添加一个条目。这些是我要插入的值:
userName=[<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e280878ca2858f838b8ecc818d8f" rel="noreferrer noopener nofollow">[email protected]</a>]
driverEmail=[<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1674737856717b777f7a3875797b" rel="noreferrer noopener nofollow">[email protected]</a>]
driverPassword=[ben]
firstName=[Ben]
lastName=[Hur]
newsletter=[false]
我遇到了这个异常:
SEVERE: Cannot create new LDAP entry
LDAPException(resultCode=object class violation, errorMessage='Entry mwUniqueIdentifier=5f9e7597-8a5f-42b0-985b-7d196040689e,ou=People,dc=mobilewarrio
r,dc=com violates the Directory Server schema configuration because it includes multiple conflicting structural objectclasses inetOrgPerson and mwUser
Account. Only a single structural objectclass is allowed in an entry')
谁能告诉我这有什么问题吗?
最佳答案
您没有确切地显示您将如何插入这些值,因此很难太具体。然而,异常(exception)情况非常明显。
您尝试为条目分配 inetOrgPerson
对象类和 mwUser
对象类,但这不起作用,因为它们都定义为结构对象类,而且都不是继承自另一个(很可能 mwUser
被定义为结构对象类,因为您的架构未将其指定为 AUXILIARY
或 ABSTRACT
对象类)。
每RFC 4512 :
An object or alias entry is characterized by precisely one structural object class superclass chain which has a single structural object class as the most subordinate object class.
有两种可能的修复方法,其中应该涉及对 LDAP 架构进行简单的更改:
如果您希望所有
mwUser
对象都是inetOrgPerson
对象,只需将mwUser
声明为的子对象类inetOrgPerson
像这样(取自 the OpenLDAP documentation ):对象类(1.1.2.2.2 NAME 'myPerson' DESC '我的人' SUP inetOrgPerson 必须(myUniqueName $给定名称) 五月我的照片)
在这种情况下,您只需将 mwUser
对象类分配给您的条目。
如果您不希望所有
mwUser
对象都是inetOrgPerson
对象,则通过指定它是辅助对象类来将其声明为 mixin,如下所示:对象类(1.1.2.2.1 NAME 'myPhotoObject' DESC 'mixin myPhoto' 辅助的 五月我的照片)
在这种情况下,您必须将 inetOrgPerson
(或另一个结构对象类)以及 mwUser
对象类分配给该对象。
关于java - LDAP插入异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11417960/