directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guofeng Zhang" <guof...@radvision.com>
Subject Help: About testing HelloWorld partition demo with Apache DS 1.5.6
Date Wed, 31 Mar 2010 09:06:53 GMT
Hi,

 

I evaluating Apache DS 1.5.6 in a standalone application without using
server.xml file. The following is main code of Helloworld partition
demo:

         public static void main(String[] args) throws Exception {

                   LOG.info("Starting the LDAP server");

                   long startTime = System.currentTimeMillis();

 

                   System.setProperty("workingDirectory",
"server-work");

 

                   DirectoryServiceFactory factory =
DefaultDirectoryServiceFactory.DEFAULT;

                   factory.init("default");

                   DirectoryService directoryService =
factory.getDirectoryService();

 

                   directoryService.setShutdownHookEnabled(true);

 

                   HelloWorldPartition helloPartition = new
HelloWorldPartition();

                   helloPartition.setSuffix("ou=helloWorld");

 
helloPartition.setSchemaManager(directoryService.getSchemaManager());

                   helloPartition.initialize();

                   directoryService.addPartition(helloPartition);

 

                   LdapServer ldapServer = new LdapServer();

                   ldapServer.setDirectoryService(directoryService);

                   ldapServer.setAllowAnonymousAccess(true);

 

                   TcpTransport ldapTransport = new TcpTransport(10389);

                   ldapServer.setTransports(ldapTransport);

 

                   ApacheDS apacheDS = new ApacheDS(ldapServer);

                   apacheDS.setLdifDirectory(new File("ldif"));

 

                   apacheDS.startup();

                   if (LOG.isInfoEnabled()) {

                            LOG.info("LDAP server: started in {}
milliseconds", (System

                                               .currentTimeMillis() -
startTime)

                                               + "");

                   }

         }

 

Please note that I also load the ldif files that defined the new schemas
for our data.

 

I think DirectoryServiceFactory class deal with the startup and schema
loading improperly, so I have to make the following change:

  (1)commented out directoryService.startup() in
DefaultDirectoryServiceFactory.build().

  (2)commented out FileUtils.deleteDirectory( workingDirectory ) in
DefaultDirectoryServiceFactory.initSchema() (I do not want the schema to
be re-extract when I restart the above application -- to short the
startup time).

 

When the above application first launched, everything works well. I stop
it, then re-launch it, I got the following exception:

Exception in thread "main"
javax.naming.directory.InvalidAttributeValueException: ERR_04131 The
value is expected to be a String

         at
org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute.get
String(DefaultClientAttribute.java:202)

         at
org.apache.directory.shared.ldap.schema.loader.ldif.SchemaEntityFactory.
setSchemaObjectProperties(SchemaEntityFactory.java:1106)

         at
org.apache.directory.shared.ldap.schema.loader.ldif.SchemaEntityFactory.
getAttributeType(SchemaEntityFactory.java:995)

         at
org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManage
r.addAttributeTypes(DefaultSchemaManager.java:727)

         at
org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManage
r.addSchemaObjects(DefaultSchemaManager.java:225)

         at
org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManage
r.load(DefaultSchemaManager.java:682)

         at
org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManage
r.loadDepsFirst(DefaultSchemaManager.java:1130)

         at
org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManage
r.loadWithDeps(DefaultSchemaManager.java:1021)

         at
org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManage
r.loadAllEnabled(DefaultSchemaManager.java:912)

         at
org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.
initSchema(DefaultDirectoryServiceFactory.java:147)

         at
org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.
build(DefaultDirectoryServiceFactory.java:207)

         at
org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.
init(DefaultDirectoryServiceFactory.java:93)

         at
org.apache.directory.samples.partition.hello.Main.main(Main.java:47)

 

but if 

(1) uncomment out FileUtils.deleteDirectory( workingDirectory ) so that
each time the schemas are re-extracted, thing goes well,

(2) still comment out FileUtils.deleteDirectory( workingDirectory ), but
do not load the ldif files. Clean up the work directory created by Apach
DS, make the test again, everything goes well even if I relaunch the
above application.

 

What is wrong with my test?

 

Thanks

 

Guofeng

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message