• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

failed to retrieve attributes from weblogic embeded ldap

 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, I'm using JNDI to retrieve attributes from weblogic8.1 embeded ldap.
my code is like below:

String userDN = "uid=bigrez,ou=people,ou=myrealm,dc=bigrezdomain";
DirContext dirCtx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
ht.put(Context.PROVIDER_URL, "ldap://tiger:7001");
ht.put(Context.SECURITY_PRINCIPAL, userDN);
ht.put(Context.SECURITY_CREDENTIALS, "xxxx");
try{
dirCtx = new InitialDirContext(ht);
Attributes answer = dirCtx.getAttributes("uid=adminbigrez,ou=people,ou=myrealm,dc=bigrezdomain");
NamingEnumeration attrEnum = answer.getAll();
while(attrEnum.hasMore()){
Attribute attr = (Attribute)attrEnum.next();
String id = attr.getID();

}

but cannot retrieve any attributes from that entry, attrEnum always has no elements, while I'm pretty sure the DN="uid=adminbigrez,ou=people,ou=myrealm,dc=bigrezdomain" is correct.

could any one here help me out?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic