Erstellen Sie eine neue Partition mit Apache DS

Ich versuche, mit Apache DS komplexe Partitionen zu erstellen

        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);

Es funktioniert gut und ich habe keine Probleme. Aber als ich versuchte, eine komplexere Partition zu erstellen, wie diese:

        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);

Ich habe eine Ausnahme wie folgt:

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.(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)

Kannst du mir bitte helfen?

Exception in this line:  service.getAdminSession().add(serviceEntry);
0
Fest. Bitte sehen Sie es.
hinzugefügt der Autor Java Dude, Quelle
Regel 0 Geben Sie immer die vollständige Stapelverfolgung ein; Regel 1 Identifizieren Sie die Codezeile, die die Ausnahme ausgelöst hat.
hinzugefügt der Autor Jim Garrison, Quelle

1 Antworten

So fixiert:

    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);
    }
0
hinzugefügt