我正在尝试使用Apache DS创建复杂的partitition
Dn dnApache = new Dn("ou=test,dc=Apache,dc=org");
Entry entryApache = service.newEntry(dnApache);
entryApache.add("objectClass", "top", "domain", "extensibleObject");
entryApache.add("dc", "Apache");
service.getAdminSession().add(entryApache);
它运作良好,我没有问题。但是当我尝试创建更复杂的分区时,就像这样:
Dn dnApache = new Dn("ou=test,dc=Apache,dc=org");
Entry entryApache = service.newEntry(dnApache);
entryApache.add("objectClass", "top", "domain", "extensibleObject");
entryApache.add("dc", "Apache");
service.getAdminSession().add(entryApache);
Dn serviceDN = new Dn("ou=service,ou=test,dc=Apache,dc=org");
Entry serviceEntry = service.newEntry(serviceDN);
entryApache.add("objectClass", "top", "organizationalUnit");
entryApache.add("dc", "Service");
service.getAdminSession().add(serviceEntry);
我有这样的例外:
org.apache.directory.api.ldap.model.exception.LdapSchemaViolationException: ERR_60 Entry ou=service,ou=test,dc=Apache,dc=org does not contain a STRUCTURAL ObjectClass
at org.apache.directory.server.core.schema.SchemaInterceptor.assertObjectClasses(SchemaInterceptor.java:1493)
at org.apache.directory.server.core.schema.SchemaInterceptor.check(SchemaInterceptor.java:951)
at org.apache.directory.server.core.schema.SchemaInterceptor.add(SchemaInterceptor.java:1045)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:416)
at org.apache.directory.server.core.exception.ExceptionInterceptor.add(ExceptionInterceptor.java:188)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:416)
at org.apache.directory.server.core.admin.AdministrativePointInterceptor.add(AdministrativePointInterceptor.java:1201)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:416)
at org.apache.directory.server.core.authz.AciAuthorizationInterceptor.add(AciAuthorizationInterceptor.java:516)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:416)
at org.apache.directory.server.core.referral.ReferralInterceptor.add(ReferralInterceptor.java:249)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:416)
at org.apache.directory.server.core.authn.AuthenticationInterceptor.add(AuthenticationInterceptor.java:335)
at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:416)
at org.apache.directory.server.core.normalization.NormalizationInterceptor.add(NormalizationInterceptor.java:127)
at org.apache.directory.server.core.DefaultOperationManager.add(DefaultOperationManager.java:394)
at org.apache.directory.server.core.shared.DefaultCoreSession.add(DefaultCoreSession.java:193)
at org.apache.directory.server.core.shared.DefaultCoreSession.add(DefaultCoreSession.java:170)
at EmbeddedADSVerTrunk.initDirectoryService(EmbeddedADSVerTrunk.java:218)
at EmbeddedADSVerTrunk.<init>(EmbeddedADSVerTrunk.java:234)
at EmbeddedADSVerTrunk.main(EmbeddedADSVerTrunk.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
你能帮帮我吗?
Exception in this line: service.getAdminSession().add(serviceEntry);
答案 0 :(得分:0)
以这种方式修复:
Partition testPartition = addPartition("test", "ou=test,dc=apache,dc=org");
Partition servicePartition = addPartition("service", "ou=service,ou=test,dc=apache,dc=org");
addIndex(infopulsePartition, "objectClass", "ou", "uid");
addIndex(servicePartition, "objectClass", "ou", "uid");
service.startup();
if (!service.getAdminSession().exists(infopulsePartition.getSuffixDn())) {
Dn dnApache = new Dn("ou=test,dc=apache,dc=org");
Entry entryApache = service.newEntry(dnApache);
entryApache.add("objectClass", "top", "domain", "extensibleObject");
entryApache.add("dc", "Apache");
service.getAdminSession().add(entryApache);
}
if (!service.getAdminSession().exists(servicePartition.getSuffixDn())) {
Dn dnApache = new Dn("ou=service,ou=test,dc=apache,dc=org");
Entry entryApache = service.newEntry(dnApache);
entryApache.add("objectClass", "top", "domain", "extensibleObject");
entryApache.add("dc", "Apache");
service.getAdminSession().add(entryApache);
}