PDA

View Full Version : Spring-LDAP Sever Compatibility



edillon
Jul 17th, 2006, 04:51 PM
Question: Can I use SPRING-LDAP (ldaptemplate) to search any ldap server or does the server have to be one that supports a certain version (v2, v3?)

I ask this question because while I can connect and search a server in my org using javax.naming, I cannot search the same server using ldaptemplate, or more specifically, the search does not return expected results.

Note that I use ldaptemplate to connect/search two other ldap servers in my org and it works as expected, hence my question.

I am using ldaptemplate 1.0.2 with JDK 1.4.2 on WinXP

// I get results using this:
NamingEnumeration results =
dirContext.search(this.SEARCH_BASE, this.SEARCH_FILTER,
new SearchControls().setSearchScope(SearchControls.ONE LEVEL_SCOPE));

//no results using this when LdapContextSource is initialized using same variables used with DirContext example
List listResults = ldapTemplate.search(this.SEARCH_BASE, this.SEARCH_FILTER, SearchControls.ONELEVEL_SCOPE, new UofUAttributesMapper());

Thanks,

ulsa
Jul 18th, 2006, 07:15 AM
When you have an LDAPv2 server, you need to use the DirContextSource rather than the LdapContextSource.

As it works with two of your servers, could it be that the other server is LDAPv2-only?