directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Louie, Kenneth W" <>
Subject Re: Trying to create a partition programmatically - need help
Date Wed, 12 Feb 2014 15:51:09 GMT
I'm trying to create a new partition on a remote ApacheDS server. I can do it through the Studio,
but I would like to automate this process. Is it possible to do this programmatically? The
examples I see are for an embedded server.


From: <Louie>, "Louie, Kenneth W" <<>>
Date: Tuesday, February 11, 2014 1:53 PM
To: "<>" <<>>,
"<>" <<>>
Subject: Trying to create a partition programmatically - need help

I'm trying to create a partition programatically. I've tried following the example on the
ApacheDS website (
, but this example is definitely not correct.

Here is my code:

try {
      LdapConnection connection = new LdapNetworkConnection(host, port);
      connection.bind(admin, password);"Loading Schema...");
      SchemaManager schemaManager = connection.getSchemaManager();
      Dn suffixDn = new Dn(schemaManager, "dc=newParition,dc=com");"Start to create partition...");
      JdbmPartition newPartition = new JdbmPartition(schemaManager);
      newPartition.setPartitionPath(new URI("file:///var/lib/apacheds-2.0.0-M15/default/partitions/newParition"));

      newPartition.addIndex(new JdbmIndex("objectClass", false));
      newPartition.addIndex(new JdbmIndex("dc", false));

      Entry contextEntry = new DefaultEntry(schemaManager, suffixDn);
      contextEntry.put("objectClass", "domain", "top");
      contextEntry.put("dc", "newParition");"Initializing Parition");
      newPartition.initialize();"Adding Entry to Partition");
      newPartition.add(new AddOperationContext(null, contextEntry));
} catch (URISyntaxException ex) {
      log.error("Error with partition location: " + ex);
} catch (Exception ex) {
      log.error("Error creating partition: " + ex);

When I run this, I'm seeing:

Error creating partition:
ERR_219 Entry dc=newParition,dc=com contains no entryCsn attribute: Entry …

It doesn't even look like the partition is being added to my server (when I restart my apacheds
server, I don't see any new namingContexts under the Root DSE). I think I'm missing some steps
here, but not sure what they are. Can anyone help me? I'd greatly appreciate it.


View raw message