directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SCHEDENIG Marian <>
Subject Re: [ApacheDS] Class path problems when embedding 1.5.6/1.5.7 in a Tomcat servlet
Date Mon, 17 May 2010 15:31:37 GMT
Kiran Ayyagari wrote:
> can't say whats happening without looking at your initialization
> code however
> can you take a look at the initSchema() method in [1].
> Having said this I have faced an issue with JarLdifSchemaLoader
> when used in a servlet container, but
> when used LdifSchemaLoader the problem was solved.

The problem actually arises before the schema loader is called:

SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );

This will search for schema files in the class path, assuming that the environment variable
"java.class.path" contains all the libraries/jars available to the current class loader. However,
in Tomcat (at least Tomcat 6, that is), that environment variable contains only one single
entry, Tomcat's own bootstrap.jar. As a result, the LDIF extractor finds no matches and copies
no files, the working directory is empty and the schema loader complains that it can't find

> Would be great if you provide more info about the environment and
> if possible the way you are
> initializing the server.

Tomcat 6.0.26, Sun JDK 1.6.0_16, Windows Vista.

ApacheDS initialisation goes like this:

    	DirectoryServiceFactory factory = DefaultDirectoryServiceFactory.DEFAULT;

      directoryService = factory.getDirectoryService();
	initializeRepository(); // this sets up my partition and data

	Transport transport = new TcpTransport(port);
	ldapService = new LdapServer();

(This used to be based on the 1.5.5 example code for creating a servlet wrapper, but I had
to blindly rewrite most of it when I upgrade to 1.5.6)

However, unless I can somehow prevent DefaultSchemaLdifExtractor from getting called (and
yet provide all the data it would normally handle), I don't think my initialisation code has
much impact on the real problem.


View raw message