PDA

View Full Version : Basic search problem



koevet
Dec 6th, 2006, 08:42 AM
Hello,
I have the following code:


DistinguishedName name = new DistinguishedName("DC=extranet,DC=cap");
name.add("ou", "test");

List l = ldapTemplate.search(name.encode(), "objectClass=*", SearchControls.SUBTREE_SCOPE, new AttributesMapper() {
public Object mapFromAttributes(Attributes attrs) throws NamingException {

return attrs.get("cn").get();
}
}
);
System.out.println("!!!!!!!!!!!!!!!!!!>" + l.size());
...


The List size is alway 0. I have tried different approaches but with no luck.
The LDAP server (MS AD) returns the correct reply if I use any kind of ldap browser.

Any idea?
Thanks
Luciano

rasky
Dec 7th, 2006, 02:55 PM
Have you specified a base path in the ContextSource setup? In that case it should not be included in the search base.