directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Zoerner <>
Subject Connecting the embedded way via JNDI: Cannot find directory service in environment
Date Sat, 04 Oct 2008 21:58:40 GMT
Hi all,

currently I try to update the example on how to embedd ApacheDS in a WebApp

in order to let it work with ApacheDS 1.5.4. The API has been changed 
since 1.5.1 (for which the example has been created for), hence the 
source code examples do not work anymore.

My web app is already able to start and stop a 1.5.4 ApacheDS server via 
a ServletContextListener.

Now I have a question regarding an embedded client. In the example, a 
servlet connects to the server without wire protocol (embedded). It uses 
JNDI for that. The old cfg does not seem to work. An env like this


Hashtable<Object, Object> env = new Hashtable<Object, Object>();
env.put(Context.PROVIDER_URL, "");
CoreContextFactory.class.getName() );
env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");
env.put(Context.SECURITY_AUTHENTICATION, "simple");


causes an error, if the InitialContext is created:

javax.naming.ConfigurationException: Cannot find directory service in 


It seems that I have to do something like this:

env.put( DirectoryService.JNDI_KEY, directoryService );

as in AbstractServerTest. Is this right? In this case, I have to 
remember the DirectoryService instance somewhere. Solvable, but the old 
way was easier ... Or am I totally wrong?

Thanks in advance,

View raw message