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
<?xml version="1.0" encoding="UTF-8"?>

<!-- Config beans for 1.5.8-snapshot ApacheDS -->

<beans
  xmlns="http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:util="http://www.springframework.org/schema/util";
  xmlns:p="http://www.springframework.org/schema/p";
  xsi:schemaLocation="http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                      http://www.springframework.org/schema/util     http://www.springframework.org/schema/util/spring-util-2.5.xsd";>

  <!-- Set up property configuration using the defaults and the externally set 'props' bean -->

  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="propertiesArray">
      <list>

        <!-- In-line properties file magic -->

        <value>
          apacheds.ldapport  = 10389
          apacheds.ldapsport = 10686
        </value>

        <!-- Application properties from outside -->

        <ref bean="props"/>
      </list>
    </property>
  </bean>
  
  <bean class="org.apache.directory.server.config.beans.DirectoryServiceBean" id="dsb">
    <property name="partitions">
      <list>
        <ref bean="sp"/>
      </list>
    </property>
  </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">
    <constructor-arg value="/tmp/rde"/>
  </bean>
  
  <bean id="sm" class="org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager"/>

  <bean id="sp" class="org.apache.directory.server.config.beans.JdbmPartitionBean" p:partitionId="system"
        p:partitionSuffix-ref="sdn" 
        p:partitionSyncOnWrite="true"
        p:partitionCacheSize="100" 
        p:jdbmPartitionOptimizerEnabled="true">
    <property name="indexes">
      <list>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.1" p:indexCacheSize="100"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.2" p:indexCacheSize="100"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.3" p:indexCacheSize="100"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.4" p:indexCacheSize="100"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.5" p:indexCacheSize="10"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.6" p:indexCacheSize="10"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="1.3.6.1.4.1.18060.0.4.1.2.7" p:indexCacheSize="10"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="ou"                          p:indexCacheSize="10"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="uid"                         p:indexCacheSize="10"/>
        <bean class="org.apache.directory.server.config.beans.JdbmIndexBean" p:indexAttributeId="objectClass"                 p:indexCacheSize="10"/>
      </list>
    </property>
  </bean>

  <bean id="sdn" class="org.apache.directory.shared.ldap.model.name.Dn">
    <constructor-arg value="ou=system"/>
  </bean>
  
</beans>

Reply via email to