Java - JNDI y Active Directory

 
Vista:

JNDI y Active Directory

Publicado por Pedro (2 intervenciones) el 23/04/2005 21:18:14
Soy nuevo con el JNDI, quiero hacer una conexión al active directory y tengo este código:

public static void main(String[] args)
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://too-03:389");

try {
// Crea el contexto inicial
DirContext ctx = new InitialDirContext(env);

// Pregunto por todos los atributos del objeto
Attributes attrs = ctx.getAttributes("cn=pgarcia, ou=TOO");

// Busca el atributo surname ("sn") y lo muestro
System.out.println("sn: " + attrs.get("sn").get());

} catch (NamingException e) {
System.err.println("Problemas de captura de atributos:" + e);
System.out.println("Hola");
}
}
}

No se que hara este código pero al ejecutar me sale este error:

javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C0905FF, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece];
remaining name 'cn=pgarcia, ou=TOO'

Si algiuen me ayuda por favor
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder