Java apacheDS 无法创建新条目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20003709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
apacheDS unable to create new entry
提问by
I'm using Apache Directory Studio 2.0.0
and ApacheDS 2.0
. After creating a new partition o=SevenSeans,dc=com
, as said in http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.htmli'm trying to create a new entry. I select objectClass organizationalPerson
and type parent o=SevenSeans,dc=com
, RDN uid=Name
. Then i click next and type value of cn
and sn
attributes. Now i click finish and have exception:
我正在使用Apache Directory Studio 2.0.0
和ApacheDS 2.0
。创建新分区后o=SevenSeans,dc=com
,如http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html 中所述,我正在尝试创建一个新条目。我选择 objectClassorganizationalPerson
并输入 parent o=SevenSeans,dc=com
, RDN uid=Name
。然后我单击下一步并键入值cn
和sn
属性。现在我点击完成并有例外:
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.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.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' )
)
]]
If i use import->LDIF
and choose captain-hook-hierarchy.ldif
如果我使用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.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]
How do I fix this? It's ok to create new entry if i choose top
class.
我该如何解决?如果我选择top
类,则可以创建新条目。
采纳答案by Sionnach733
There are a number of issues with that tutorial(spelling, UI looks different, etc) but i have managed to import the sample data and add a new entry.
该教程存在许多问题(拼写、UI 看起来不同等),但我设法导入了示例数据并添加了一个新条目。
your error occurs for this reason: com contains more than one STRUCTURAL ObjectClass
. this is occurring because domain
and organizationalPerson
are both structural and will not work together, try removing domain
. For more info, see LDAP objectClasses
您的错误发生的原因是:com contains more than one STRUCTURAL ObjectClass
。发生这种情况是因为domain
和organizationalPerson
都是结构性的并且不能一起工作,请尝试删除domain
. 有关详细信息,请参阅LDAP 对象类
To import the captain-hook-hierarchy.ldif
you need to create a new partition first. The tutorial is inconsistent with naming conventions and is the cause of your error.
Create a new partition:
要导入captain-hook-hierarchy.ldif
您需要先创建一个新分区。该教程与命名约定不一致,是导致您出错的原因。创建一个新分区:
ID:SevenSeas
Suffix: o=sevenSeas
The error you get is because of the ,dc=com
from the tutorial. if you open the .ldif you'll see there is no reference to ,dc=com
.
你得到的错误是因为,dc=com
教程中的。如果您打开 .ldif,您会看到没有对 .ldif 的引用,dc=com
。
Next uncheck the Auto-generate context entry from suffix DN
checkbox. it doesnt create the appropriate attributes for the example. Then add these attributes:
接下来取消选中Auto-generate context entry from suffix DN
复选框。它没有为示例创建适当的属性。然后添加这些属性:
o: sevenSeas
objectClass: top
objectClass: organization
description: The context entry for suffix o=sevenSeas
Save the config.ldif file and restart the server. Then import captain-hook-hierarchy.ldif
.
The directory should populate and to add new entries just right-click on a group and Add new entry
.
保存 config.ldif 文件并重新启动服务器。然后导入 captain-hook-hierarchy.ldif
。该目录应该填充并添加新条目,只需右键单击组和Add new entry
.
Hope this helps!
希望这可以帮助!
回答by Emmanuel Lécharny
I have fixed the tutorial (http://directory.staging.apache.org/apacheds/basic-ug/1.4.3-adding-partition.htmlfor anyone who want to see the changes before the real site on http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.htmlis on line - that will take a couple of hours).
我已经修复了教程(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在线 - 这将需要几个小时)。
Thanks for report ! It would be even more convenient to create a JIRA with a description of the typoes (and a patch is even better ! The web site is text based (markdown) and available on http://svn.apache.org/repos/asf/directory/site/trunk/content/)
感谢举报!创建带有拼写错误描述的 JIRA 会更方便(补丁更好!该网站基于文本(降价),可在http://svn.apache.org/repos/asf/ 上找到目录/站点/主干/内容/)
回答by Emmanuel Lécharny
I can't comment, so...
我无法评论,所以...
Sionnach733 : you can't have 2 structural ObjectClass in an entry, exceptif they have an inheritance relation. For instance, OrganizationalPerson inherits from Person, so you can have both in an entry (even if adding OrganizationalPerson only implies that personis also implicitely added in the entry).
Sionnach733:一个条目中不能有 2 个结构化的 ObjectClass,除非它们有继承关系。例如,OrganizationalPerson 继承自 Person,因此您可以在一个条目中同时拥有两者(即使添加 OrganizationalPerson 仅意味着该人也隐式添加到条目中)。
And, yes, those rules are a bit stupid...
而且,是的,这些规则有点愚蠢......
回答by GSAN
The last versión of Apache Directory Studio (Version: 2.0.0.v20151221-M10) has a bug, a missing newline between the generated LDIF records: https://issues.apache.org/jira/browse/DIRSTUDIO-1080
Apache Directory Studio 的最新版本(版本:2.0.0.v20151221-M10)有一个错误,生成的 LDIF 记录之间缺少换行符:https://issues.apache.org/jira/browse/DIRSTUDIO-1080
Very easy to fix it, just download a new versión fixed: https://builds.apache.org/job/dir-studio/
修复它很容易,只需下载一个新的修复版本:https://builds.apache.org/job/dir-studio/