You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Richard Evans <ri...@datanomic.com> on 2011/05/22 21:40:00 UTC
Embedding ApacheDS using DirectoryServiceBean etc
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
org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
at
org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
at
org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
at
org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
at
org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
It looks as though the SchemaManager instance is never set on the
SchemaPartition created by DefaultSchemaService.
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?
Thanks
Richard
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Alex Karasulu <ak...@apache.org>.
On Wed, May 25, 2011 at 12:31 PM, Emmanuel Lecharny <el...@gmail.com>wrote:
> On 5/25/11 11:21 AM, Alex Karasulu wrote:
>
>> This is a good point (re: the value of doing substitutions) and something
>> we
>> should consider for our configuration in LDAP. Maybe not 1:1 but some like
>> mechanism might have value for users like Richard.
>>
>
> Yeah, definitively. But a side project for that would be the best solution,
> I think.
>
>
Agreed it's not a critical feature - nice to have.
Best --Alex
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 5/25/11 11:21 AM, Alex Karasulu wrote:
> This is a good point (re: the value of doing substitutions) and something we
> should consider for our configuration in LDAP. Maybe not 1:1 but some like
> mechanism might have value for users like Richard.
Yeah, definitively. But a side project for that would be the best
solution, I think.
> Best,
> Alex
>
> On Mon, May 23, 2011 at 1:39 PM, Richard Evans
> <ri...@datanomic.com>wrote:
>
>> I agree, the LDIF configuration is great. The reason for persisting with
>> the XML approach is that I need to do Spring like property substation to set
>> ports, etc, as in:
>>
>> <property name="transports">
>> <list>
>> <bean
>> class="org.apache.directory.server.protocol.shared.transport.TcpTransport"
>> ... p:port="${apacheds.ldapport}"
>>
>> For a fully embedded server, dynamic configuration changes do not seem so
>> important.
>>
>> Richard
>>
>> -----Original Message-----
>> From: Emmanuel Lecharny [mailto:elecharny@gmail.com]
>> Sent: 23 May 2011 11:36
>> To: Apache Directory Developers List
>> Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc
>>
>> On 5/23/11 12:27 PM, Richard Evans wrote:
>>> OK, I'll have to rethink. It's a bit disappointing since we've used XML
>> configuration for each of the other applications we embed - ActiveMQ, Apache
>> FTP server and Apache SSHD.
>>
>> There is a reason for such a (painful) switch : having a LDIF backed
>> configuration (Here, I should say a DIT based) allows us to dynamically
>> reconfigure the server, without having to stop and restart it. This is
>> incredibly useful.
>>
>> --
>> Regards,
>> Cordialement,
>> Emmanuel Lécharny
>> www.iktek.com
>>
>>
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Alex Karasulu <ak...@apache.org>.
This is a good point (re: the value of doing substitutions) and something we
should consider for our configuration in LDAP. Maybe not 1:1 but some like
mechanism might have value for users like Richard.
Best,
Alex
On Mon, May 23, 2011 at 1:39 PM, Richard Evans
<ri...@datanomic.com>wrote:
> I agree, the LDIF configuration is great. The reason for persisting with
> the XML approach is that I need to do Spring like property substation to set
> ports, etc, as in:
>
> <property name="transports">
> <list>
> <bean
> class="org.apache.directory.server.protocol.shared.transport.TcpTransport"
> ... p:port="${apacheds.ldapport}"
>
> For a fully embedded server, dynamic configuration changes do not seem so
> important.
>
> Richard
>
> -----Original Message-----
> From: Emmanuel Lecharny [mailto:elecharny@gmail.com]
> Sent: 23 May 2011 11:36
> To: Apache Directory Developers List
> Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc
>
> On 5/23/11 12:27 PM, Richard Evans wrote:
> > OK, I'll have to rethink. It's a bit disappointing since we've used XML
> configuration for each of the other applications we embed - ActiveMQ, Apache
> FTP server and Apache SSHD.
>
> There is a reason for such a (painful) switch : having a LDIF backed
> configuration (Here, I should say a DIT based) allows us to dynamically
> reconfigure the server, without having to stop and restart it. This is
> incredibly useful.
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>
RE: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Richard Evans <ri...@datanomic.com>.
I agree, the LDIF configuration is great. The reason for persisting with the XML approach is that I need to do Spring like property substation to set ports, etc, as in:
<property name="transports">
<list>
<bean class="org.apache.directory.server.protocol.shared.transport.TcpTransport" ... p:port="${apacheds.ldapport}"
For a fully embedded server, dynamic configuration changes do not seem so important.
Richard
-----Original Message-----
From: Emmanuel Lecharny [mailto:elecharny@gmail.com]
Sent: 23 May 2011 11:36
To: Apache Directory Developers List
Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc
On 5/23/11 12:27 PM, Richard Evans wrote:
> OK, I'll have to rethink. It's a bit disappointing since we've used XML configuration for each of the other applications we embed - ActiveMQ, Apache FTP server and Apache SSHD.
There is a reason for such a (painful) switch : having a LDIF backed
configuration (Here, I should say a DIT based) allows us to dynamically
reconfigure the server, without having to stop and restart it. This is
incredibly useful.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 5/23/11 12:27 PM, Richard Evans wrote:
> OK, I'll have to rethink. It's a bit disappointing since we've used XML configuration for each of the other applications we embed - ActiveMQ, Apache FTP server and Apache SSHD.
There is a reason for such a (painful) switch : having a LDIF backed
configuration (Here, I should say a DIT based) allows us to dynamically
reconfigure the server, without having to stop and restart it. This is
incredibly useful.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Kiran Ayyagari <ka...@apache.org>.
On Mon, May 23, 2011 at 3:57 PM, Richard Evans
<ri...@datanomic.com> wrote:
> OK, I'll have to rethink. It's a bit disappointing since we've used XML configuration for each of the other applications we embed - ActiveMQ, Apache FTP server and Apache SSHD.
>
how about creating a new class which includes just the schema loading
part and configure it in the XML?
> Richard
>
> -----Original Message-----
> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] On Behalf Of Kiran Ayyagari
> Sent: 23 May 2011 10:53
> To: Apache Directory Developers List
> Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc
>
> On Mon, May 23, 2011 at 3:16 PM, Richard Evans
> <ri...@datanomic.com> wrote:
>> 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."
>>
> well, you can use the beans for *configuring* the server, not to
> launch it or perform some load operations automatically.
>
>> 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.
>>
>> Richard
>>
>> -----Original Message-----
>> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
>> <ri...@datanomic.com> 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="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
>>> ...
>>> </bean>
>>>
>>> <bean id="ds" class="org.apache.directory.server.config.ServiceBuilder" factory-method="createDirectoryService">
>>> <constructor-arg ref="dsb"/>
>>> <constructor-arg ref="il"/>
>>> <constructor-arg ref="sm"/>
>>> </bean>
>>>
>>> <bean id="il" class="org.apache.directory.server.core.InstanceLayout">
>>> ...
>>> </bean>
>>>
>>> <bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>
>>>
>> 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
>> JarLdifSchemaLoader
>> 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
>> schemaManager.loadAllEnabled();
>>
>> HTH
>>> Richard
>>>
>>> -----Original Message-----
>>> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
>>> <ri...@datanomic.com> 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
>>>> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
>>>> at
>>>> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
>>>> at
>>>> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
>>>> at
>>>> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
>>>> at
>>>> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
>>>> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>>>>
>>>> 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
>>
>
>
>
> --
> Kiran Ayyagari
>
--
Kiran Ayyagari
RE: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Richard Evans <ri...@datanomic.com>.
OK, I'll have to rethink. It's a bit disappointing since we've used XML configuration for each of the other applications we embed - ActiveMQ, Apache FTP server and Apache SSHD.
Richard
-----Original Message-----
From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] On Behalf Of Kiran Ayyagari
Sent: 23 May 2011 10:53
To: Apache Directory Developers List
Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc
On Mon, May 23, 2011 at 3:16 PM, Richard Evans
<ri...@datanomic.com> wrote:
> 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."
>
well, you can use the beans for *configuring* the server, not to
launch it or perform some load operations automatically.
> 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.
>
> Richard
>
> -----Original Message-----
> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
> <ri...@datanomic.com> 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="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
>> ...
>> </bean>
>>
>> <bean id="ds" class="org.apache.directory.server.config.ServiceBuilder" factory-method="createDirectoryService">
>> <constructor-arg ref="dsb"/>
>> <constructor-arg ref="il"/>
>> <constructor-arg ref="sm"/>
>> </bean>
>>
>> <bean id="il" class="org.apache.directory.server.core.InstanceLayout">
>> ...
>> </bean>
>>
>> <bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>
>>
> 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
> JarLdifSchemaLoader
> 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
> schemaManager.loadAllEnabled();
>
> HTH
>> Richard
>>
>> -----Original Message-----
>> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
>> <ri...@datanomic.com> 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
>>> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
>>> at
>>> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
>>> at
>>> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
>>> at
>>> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
>>> at
>>> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
>>> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>>>
>>> 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
>
--
Kiran Ayyagari
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Kiran Ayyagari <ka...@apache.org>.
On Mon, May 23, 2011 at 3:16 PM, Richard Evans
<ri...@datanomic.com> wrote:
> 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."
>
well, you can use the beans for *configuring* the server, not to
launch it or perform some load operations automatically.
> 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.
>
> Richard
>
> -----Original Message-----
> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
> <ri...@datanomic.com> 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="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
>> ...
>> </bean>
>>
>> <bean id="ds" class="org.apache.directory.server.config.ServiceBuilder" factory-method="createDirectoryService">
>> <constructor-arg ref="dsb"/>
>> <constructor-arg ref="il"/>
>> <constructor-arg ref="sm"/>
>> </bean>
>>
>> <bean id="il" class="org.apache.directory.server.core.InstanceLayout">
>> ...
>> </bean>
>>
>> <bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>
>>
> 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
> JarLdifSchemaLoader
> 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
> schemaManager.loadAllEnabled();
>
> HTH
>> Richard
>>
>> -----Original Message-----
>> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
>> <ri...@datanomic.com> 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
>>> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
>>> at
>>> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
>>> at
>>> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
>>> at
>>> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
>>> at
>>> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
>>> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>>>
>>> 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
>
--
Kiran Ayyagari
RE: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Richard Evans <ri...@datanomic.com>.
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.
Richard
-----Original Message-----
From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
<ri...@datanomic.com> 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="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
> ...
> </bean>
>
> <bean id="ds" class="org.apache.directory.server.config.ServiceBuilder" factory-method="createDirectoryService">
> <constructor-arg ref="dsb"/>
> <constructor-arg ref="il"/>
> <constructor-arg ref="sm"/>
> </bean>
>
> <bean id="il" class="org.apache.directory.server.core.InstanceLayout">
> ...
> </bean>
>
> <bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>
>
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
JarLdifSchemaLoader
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
schemaManager.loadAllEnabled();
HTH
> Richard
>
> -----Original Message-----
> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
> <ri...@datanomic.com> 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
>> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
>> at
>> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
>> at
>> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
>> at
>> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
>> at
>> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
>> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>>
>> 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
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Kiran Ayyagari <ka...@apache.org>.
On Mon, May 23, 2011 at 2:27 PM, Richard Evans
<ri...@datanomic.com> 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="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
> ...
> </bean>
>
> <bean id="ds" class="org.apache.directory.server.config.ServiceBuilder" factory-method="createDirectoryService">
> <constructor-arg ref="dsb"/>
> <constructor-arg ref="il"/>
> <constructor-arg ref="sm"/>
> </bean>
>
> <bean id="il" class="org.apache.directory.server.core.InstanceLayout">
> ...
> </bean>
>
> <bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>
>
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
JarLdifSchemaLoader
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
schemaManager.loadAllEnabled();
HTH
> Richard
>
> -----Original Message-----
> From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
> <ri...@datanomic.com> 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
>> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
>> at
>> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
>> at
>> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
>> at
>> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
>> at
>> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
>> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>>
>> 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
RE: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Richard Evans <ri...@datanomic.com>.
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="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
...
</bean>
<bean id="ds" class="org.apache.directory.server.config.ServiceBuilder" factory-method="createDirectoryService">
<constructor-arg ref="dsb"/>
<constructor-arg ref="il"/>
<constructor-arg ref="sm"/>
</bean>
<bean id="il" class="org.apache.directory.server.core.InstanceLayout">
...
</bean>
<bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>
Richard
-----Original Message-----
From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] 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
<ri...@datanomic.com> 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
> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
> at
> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
> at
> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
> at
> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
> at
> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>
> 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
Re: Embedding ApacheDS using DirectoryServiceBean etc
Posted by Kiran Ayyagari <ka...@apache.org>.
On Mon, May 23, 2011 at 1:10 AM, Richard Evans
<ri...@datanomic.com> 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
> org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizerAdaptor.<init>(RegistrySynchronizerAdaptor.java:123)
> at
> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPartition.java:224)
> at
> org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:73)
> at
> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1484)
> at
> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:962)
> 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 rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49)
>
> 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