directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <ayyagariki...@gmail.com>
Subject Re: "Embedding ApacheDS as a Web Application" revisited for 1.5.4
Date Mon, 06 Oct 2008 08:57:44 GMT

hi Cheong,

    As I have something ready for a similar case am sending the reply :)

    Here is the sequence for creating a partition and adding the context 
entry

        JdbmPartition tcPartition = new JdbmPartition();
        tcPartition.setId("technetium");
        tcPartition.setCacheSize(1000);

        // Create some indices
        Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?, 
ServerEntry>>();
        indexedAttrs.add( new JdbmIndex<Object, 
ServerEntry>("objectClass"));
        indexedAttrs.add( new JdbmIndex<Object, ServerEntry>("o"));
        tcPartition.setIndexedAttributes( indexedAttrs );

        //Add suffix
        tcPartition.setSuffix("dc=technetium,dc=com");
        tcPartition.init(directoryService);
        directoryService.addPartition(tcPartition);
       
        ServerEntry entry = new DefaultServerEntry( 
directoryService.getRegistries(), new LdapDN( "dc=technetium,dc=com") );
        entry.put(SchemaConstants.OBJECT_CLASS_AT,  
SchemaConstants.TOP_OC, "domain" );
        entry.put("dc","technetium");
        entry.put("dc","com");
       
        directoryService.startup();
        directoryService.getAdminSession().add( entry );
 
HTH
Kiran Ayyagari

Cheong Chung Onn wrote:
> Hi Emmanuel,
>
> My apologies for not providing more info. I received a 
> LdapNameNotFoundException, this exception is triggered when i add an 
> OperationContext to the partition nexus using -  
> directoryService.getPartitionNexus().add(new 
> AddOperationContext(directoryService.getAdminSession(), entry));
>
>
> Would appreciate if you could help to validate the steps i did in 
> creating a partition.
>
> Thanks in advance.
>
> Regards
> chung-onn
>
>
>
>
> org.apache.directory.shared.ldap.exception.LdapNameNotFoundException: 
> dc=technetium,dc=com
>    at 
> org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus.java:1097)

>
>    at 
> org.apache.directory.server.core.partition.DefaultPartitionNexus.add(DefaultPartitionNexus.java:819)

>
>    at 
> com.greenfossil.platform.directory.EmbeddedApacheDSServer.createPartition(EmbeddedApacheDSServer.java:171)

>
>    at 
> com.greenfossil.platform.directory.EmbeddedApacheDSServer.startup(EmbeddedApacheDSServer.java:194)

>
>    at 
> com.greenfossil.platform.directory.EmbeddedApacheDSServerTest.testEmbeddedApacheDSServer(EmbeddedApacheDSServerTest.java:17)

>
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>
>    at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

>
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at 
> org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
>    at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
>    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
>    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
>    at 
> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126) 
>
>    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
>    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
>    at org.testng.TestRunner.privateRun(TestRunner.java:582)
>    at org.testng.TestRunner.run(TestRunner.java:477)
>    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
>    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
>    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
>    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
>    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823)
>    at org.testng.TestNG.runSuitesLocally(TestNG.java:790)
>    at org.testng.TestNG.run(TestNG.java:708)
>    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
>    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
>
>
> Emmanuel Lecharny wrote:
>> Hi,
>>
>> Cheong Chung Onn wrote:
>>> <snip/>
>>> My problem seems to be I am unable to set the ServerEntry correctly 
>>> during the creation of the partition. Also I realized that creating 
>>> a partition can only be done after DirectoryService is started else 
>>> the partitionNexus will not be initialized.
>> What is your problem, exactly ? Do you have a stack trace, or is this 
>> just that the partition can't be created ?
>>
>> Thanks !
>>
>

Mime
View raw message