directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Evans <>
Subject RE: Embedding ApacheDS using DirectoryServiceBean etc
Date Mon, 23 May 2011 09:46:20 GMT
OK, I was trying to configure a directory server using configuration beans and the service
builder, as recommended in an earlier mail:

"And to achieve a similar configuration like above use the various XXXBean (e.x DirectoryServiceBean)
classes present in server-config module.
You can configure them in your spring file and then use ServiceBuilder to create the respective
service/server instances based on these configuration beans."

So I guess this is not possible - I need to write some code to create the schema loader, etc?
 In 1.5.7 I could configure everything using an XML file.  I would like to take this approach
so that the configuration can be changed easily by editing the XML rather than recompiling
bits of code.


-----Original Message-----
From: [] On Behalf Of Kiran Ayyagari
Sent: 23 May 2011 10:42
To: Apache Directory Developers List
Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc

On Mon, May 23, 2011 at 2:27 PM, Richard Evans
<> wrote:
> I'm not sure I get this.  It seems as though using DirectoryServiceBean and ServiceBuilder
just can never work because of this NPE.  Surely that's a bug?  I do create a schema manager
in the XML:
>  <bean class="" id="dsb">
>    ...
>  </bean>
>  <bean id="ds" class="" factory-method="createDirectoryService">
>    <constructor-arg ref="dsb"/>
>    <constructor-arg ref="il"/>
>    <constructor-arg ref="sm"/>
>  </bean>
>  <bean id="il" class="">
>    ...
>  </bean>
>  <bean id="sm" class=""/>
what I mean is that the schema manager created in this way is not
useful unless a schema loader is set.

   the procedure goes like this:

        SchemaLoader loader = new LdifSchemaLoader(
schemaPartitionDirectory ); // <-- you can also use
        schemaManager = new DefaultSchemaManager( loader );

        // We have to load the schema now, otherwise we won't be able
        // to initialize the Partitions, as we won't be able to parse
        // and normalize their suffix Dn

> Richard
> -----Original Message-----
> From: [] On Behalf Of Kiran Ayyagari
> Sent: 22 May 2011 21:02
> To: Apache Directory Developers List
> Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc
> On Mon, May 23, 2011 at 1:10 AM, Richard Evans
> <> wrote:
>> I'm experimenting with embedding ApacheDS (1.5.8-SNAPSHOT built from trunk)
>> using configuration beans created in Spring XML along with the
>> ServiceBuilder.  I've attached where I've got to so far - it is not
>> complete, but I've run into a couple of problems.
>> Firstly I get an NPE:
>> java.lang.NullPointerException
>>    at
>>    at
>>    at
>>    at
>>    at
>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>    at
>> sun.reflect.NativeMethodAccessorImpl.invoke(
>>    at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>    at java.lang.reflect.Method.invoke(
>>    at rde.tests.apacheds.LaunchADS.main(
>> It looks as though the SchemaManager instance is never set on the
>> SchemaPartition created by DefaultSchemaService.
> the SchemaManager won't be created by SchemaPartition automatically
> rather we need to set it after loading
> the schema with any of the available schema loaders.
> Take a look at the methods initSchemaLdifPartition and
> initDirectoryService present in ApacheDsService class they might give
> you an idea.
>> Secondly, in 1.5.7 the suffix for a partition was a string, now it's a Dn.
>>  There are lots of constructors for the Dn object - which should be used
>> here?
> you can use the one which takes a single string argument while
> configuring, but in general it is good to use the Dn(SchemaManager,
> String...)
> if you have access to the schema manager.
>> Thanks
>> Richard
> --
> Kiran Ayyagari

Kiran Ayyagari

View raw message