commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Kofler <roland.kof...@systemone.at>
Subject [Configuration] cant get basic JNDIConfiguration to work
Date Mon, 15 Jan 2007 16:45:54 GMT

Hi,
Is anyone using JNDIConfiguration? 
Strangely no evidence for this could be found on the web/ mailing lists etc.
I would like to implement a LDAP based Configuration, but I cant even read
keys without getting an exception:

javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object];
remaining name ''

Could somebody provide hints / working code that reads from an jndi/ ldap
source?


Second question: Id like to implement my own write functionality for
JNDIConfiguration, is this simply not done because of different possible
JNDI sources, and I will be happy when I do it for a concrete LDAPServer in
mind?
Or are there other heavy reasons I should be aware of?

Thank You A Lot,
Roland



public class DynamicConfiguarationControllerTest extends TestCase {
	
	private JNDIConfiguration jndiConfig;
	{
		BasicConfigurator.configure();
	}
	private Logger log=
Logger.getLogger(DynamicConfiguarationControllerTest.class);

	public void setUp() throws NamingException{
		Hashtable env = new Hashtable();
		env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.PROVIDER_URL, "ldap://development1:389");
		LdapContext ctx = new InitialLdapContext(env, null);
        ctx.addToEnvironment(Context.SECURITY_PRINCIPAL,
"cn=admin,dc=development1,dc=systemone,dc=at");
        ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, "secret");
        ctx.reconnect(null);
        
		jndiConfig = new JNDIConfiguration(ctx);
	}
	
	public void testJNDIWrite() throws NamingException{
		for (Iterator keys = jndiConfig.getKeys();keys.hasNext();){ /*****
exception here!! *********
			String key = (String)keys.next();
			log.debug(key);
		}
	
	
//assertTrue(jndiConfig.containsKey("uid=roland.kofler,dc=development1,dc=systemone,dc=at"));
		
	}

-- 
View this message in context: http://www.nabble.com/-Configuration--cant-get-basic-JNDIConfiguration-to-work-tf3015708.html#a8374702
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message