apacheDS无法创建新条目

时间:2013-11-15 14:46:32

标签: java apache ldap

我正在使用Apache Directory Studio 2.0.0ApacheDS 2.0。创建新分区o=SevenSeans,dc=com后,如http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html中所述,我正在尝试创建新条目。我选择objectClass organizationalPerson并输入父o=SevenSeans,dc=com,RDN uid=Name。然后我点击下一步,输入cnsn属性的值。现在我点击完成并有例外:

Error while creating entry
 - [LDAP: error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUES
  javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUEST
Message ID : 19
    Add Request :
Entry
    dn[n]: uid=Name,o=SevenSeans,dc=com
    objectclass: domain
    objectclass: top
    objectclass: extensibleObject
    objectclass: organizationalPerson
    objectclass: person
    uid: Name
    dc: SevenSeans
    sn: sf
    cn: s
: ERR_61 Entry uid=Name,o=SevenSeans,dc=com contains more than one STRUCTURAL ObjectClass: [OBJECT_CLASS ( 0.9.2342.19200300.100.4.13
 NAME 'domain'
 SUP 'top'
 STRUCTURAL
 MUST 'dc'
 MAY ( 'associatedName' $ 'o' $ 'description' $ 'businessCategory' $ 'seeAlso' $ 'searchGuide' $ 'userPassword' $ 'l' $ 'st' $ 'street' $ 'physicalDeliveryOfficeName' $ 'postalAddress' $ 'postalCode' $ 'postOfficeBox' $ 'facsimileTelephoneNumber' $ 'internationaliSDNNumber' $ 'telephoneNumber' $ 'teletexTerminalIdentifier' $ 'telexNumber' $ 'preferredDeliveryMethod' $ 'destinationIndicator' $ 'registeredAddress' $ 'x121Address' )
 )
, OBJECT_CLASS ( 2.5.6.7
 NAME 'organizationalPerson'
 DESC RFC2256: an organizational person
 SUP 'person'
 STRUCTURAL
 MAY ( 'title' $ 'x121Address' $ 'registeredAddress' $ 'destinationIndicator' $ 'preferredDeliveryMethod' $ 'telexNumber' $ 'teletexTerminalIdentifier' $ 'telephoneNumber' $ 'internationaliSDNNumber' $ 'facsimileTelephoneNumber' $ 'street' $ 'postOfficeBox' $ 'postalCode' $ 'postalAddress' $ 'physicalDeliveryOfficeName' $ 'ou' $ 'st' $ 'l' )
 )
]]; remaining name 'uid=Name,o=SevenSeans,dc=com'
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(Unknown Source)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_createSubcontext(Unknown Source)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(Unknown Source)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper$4.run(JNDIConnectionWrapper.java:669)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.runAndMonitor(JNDIConnectionWrapper.java:1305)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.checkConnectionAndRunAndMonitor(JNDIConnectionWrapper.java:1237)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.createEntry(JNDIConnectionWrapper.java:722)
    at org.apache.directory.studio.ldapbrowser.core.jobs.CreateEntryRunnable.createEntry(CreateEntryRunnable.java:224)
    at org.apache.directory.studio.ldapbrowser.core.jobs.CreateEntryRunnable.run(CreateEntryRunnable.java:124)
    at org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:112)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

  [LDAP: error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUEST
Message ID : 19
    Add Request :
Entry
    dn[n]: uid=Name,o=SevenSeans,dc=com
    objectclass: domain
    objectclass: top
    objectclass: extensibleObject
    objectclass: organizationalPerson
    objectclass: person
    uid: Name
    dc: SevenSeans
    sn: sf
    cn: s
: ERR_61 Entry uid=Name,o=SevenSeans,dc=com contains more than one STRUCTURAL ObjectClass: [OBJECT_CLASS ( 0.9.2342.19200300.100.4.13
 NAME 'domain'
 SUP 'top'
 STRUCTURAL
 MUST 'dc'
 MAY ( 'associatedName' $ 'o' $ 'description' $ 'businessCategory' $ 'seeAlso' $ 'searchGuide' $ 'userPassword' $ 'l' $ 'st' $ 'street' $ 'physicalDeliveryOfficeName' $ 'postalAddress' $ 'postalCode' $ 'postOfficeBox' $ 'facsimileTelephoneNumber' $ 'internationaliSDNNumber' $ 'telephoneNumber' $ 'teletexTerminalIdentifier' $ 'telexNumber' $ 'preferredDeliveryMethod' $ 'destinationIndicator' $ 'registeredAddress' $ 'x121Address' )
 )
, OBJECT_CLASS ( 2.5.6.7
 NAME 'organizationalPerson'
 DESC RFC2256: an organizational person
 SUP 'person'
 STRUCTURAL
 MAY ( 'title' $ 'x121Address' $ 'registeredAddress' $ 'destinationIndicator' $ 'preferredDeliveryMethod' $ 'telexNumber' $ 'teletexTerminalIdentifier' $ 'telephoneNumber' $ 'internationaliSDNNumber' $ 'facsimileTelephoneNumber' $ 'street' $ 'postOfficeBox' $ 'postalCode' $ 'postalAddress' $ 'physicalDeliveryOfficeName' $ 'ou' $ 'st' $ 'l' )
 )
]]

如果我使用import->LDIF并选择captain-hook-hierarchy.ldif

Error while importing LDIF
 - [LDAP: error code 32 - NO_SUCH_OBJECT: failed for MessageType : ADD_REQUES
javax.naming.NameNotFoundException: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for MessageType : ADD_REQUEST
Message ID : 20
    Add Request :
Entry
    dn[n]: ou=people,o=sevenSeas
    objectclass: organizationalUnit
    objectclass: top
    ou: people
: ERR_268 Cannot find a partition for ou=people,o=sevenSeas]; remaining name 'ou=people,o=sevenSeas'
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(Unknown Source)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_createSubcontext(Unknown Source)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(Unknown Source)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper$4.run(JNDIConnectionWrapper.java:669)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.runAndMonitor(JNDIConnectionWrapper.java:1305)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.checkConnectionAndRunAndMonitor(JNDIConnectionWrapper.java:1237)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.createEntry(JNDIConnectionWrapper.java:722)
    at org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifRunnable.importLdifRecord(ImportLdifRunnable.java:464)
    at org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifRunnable.importLdif(ImportLdifRunnable.java:272)
    at org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifRunnable.run(ImportLdifRunnable.java:218)
    at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:109)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

[LDAP: error code 32 - NO_SUCH_OBJECT: failed for MessageType : ADD_REQUEST
Message ID : 20
    Add Request :
Entry
    dn[n]: ou=people,o=sevenSeas
    objectclass: organizationalUnit
    objectclass: top
    ou: people
: ERR_268 Cannot find a partition for ou=people,o=sevenSeas]

我该如何解决这个问题?如果我选择top类,可以创建新条目。

4 个答案:

答案 0 :(得分:14)

该教程存在许多问题(拼写,UI看起来不同等),但我已设法导入示例数据并添加新条目。

出现此错误的原因是:com contains more than one STRUCTURAL ObjectClass。发生这种情况是因为domainorganizationalPerson都是结构性的,无法协同工作,请尝试删除domain。有关详细信息,请参阅LDAP objectClasses

要导入captain-hook-hierarchy.ldif,您需要先创建一个新分区。该教程与命名约定不一致,是导致错误的原因。 创建一个新分区:

ID:SevenSeas
Suffix: o=sevenSeas

您得到的错误是因为教程中的,dc=com。如果你打开.ldif,你会发现没有,dc=com的引用。

接下来取消选中Auto-generate context entry from suffix DN复选框。它没有为示例创建适当的属性。然后添加以下属性:

o: sevenSeas
objectClass: top
objectClass: organization
description: The context entry for suffix o=sevenSeas

保存config.ldif文件并重新启动服务器。然后导入captain-hook-hierarchy.ldif。 该目录应该填充并添加新条目,只需右键单击一个组Add new entry

希望这有帮助!

答案 1 :(得分:1)

我无法评论,所以......

Sionnach733:如果条目具有继承关系,则之外,不能在条目中包含2个结构ObjectClass。例如,OrganizationalPerson继承自Person,因此您可以在条目中同时使用两者(即使添加OrganizationalPerson仅暗示 person 也在条目中被隐含地添加)。

而且,是的,这些规则有点愚蠢......

答案 2 :(得分:1)

Apache Directory Studio的最后一个版本(版本:2.0.0.v20151221-M10)有一个错误,生成的LDIF记录之间缺少换行符:https://issues.apache.org/jira/browse/DIRSTUDIO-1080

很容易修复它,只需下载修复的新版本:https://builds.apache.org/job/dir-studio/

答案 3 :(得分:0)

我已修复教程(http://directory.staging.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html,以便任何想要在http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html上的真实网站上线之前查看更改的人 - 这将需要几个小时。)

感谢您的举报!创建一个带有错字描述的JIRA会更方便(补丁更好!网站是基于文本的(降价),可在http://svn.apache.org/repos/asf/directory/site/trunk/content/上获得)