Hello,
I am a really beginner with spring and spring LDAP, but we have a big problem with doing a search on MS AD 2003.
The AD uses only references and if we do a search on it, we get a DataRetrievalFailureException!
Here the the LDAP Config
Code snippet:Code:<bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource"> <property name="url" value="ldap://ldap.company.com:389" /> <property name="base" value="dc=company,dc=com" /> <property name="userName" value="cn=ServiceUser" /> <property name="password" value="secret" /> <property name="baseEnvironmentProperties"> <map> <entry key="java.naming.referral" value="follow" /> <entry key="java.naming.security.authentication" value="simple" /> </map> </property> </bean> <bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate"> <constructor-arg ref="contextSource" /> </bean>
With the following "ldapsearch" I get the correct result.Code:ldapTemplate.setIgnorePartialResultException(true); String filter = "(&(objectclass=person)(!(company=_*))(objectclass=computer))(mail="+email+"))"; return ldapTemplate.search("dc=company,dc=com", filter, new EngineerAttributesMapper());
Code:ldapsearch -h ldap.company.com -p 389 -x -D "cn=ServiceUser" -b dc=company,dc=com -w secret "(&(objectclass=person)(!(company=_*))(!(objectclass=computer))(mail=mail@company.com))"
Here the Exception:
Could the use of the references be the problem?Code:org.springframework.dao.DataRetrievalFailureException: Unable to communicate with LDAP server; nested exception is javax.naming.CommunicationException: Request: 2 cancelled; remaining name ''dc=company,dc=com" Caused by: javax.naming.CommunicationException: Request: 2 cancelled; remaining name ''dc=company,dc=com" at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60) at com.sun.jndi.ldap.Connection.readReply(Connection.java:405) at com.sun.jndi.ldap.LdapClient.getSearchReply(LdapClient.java:611) at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:534) at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1944) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1806) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1731) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248) at org.springframework.ldap.LdapTemplate$4.executeSearch(LdapTemplate.java:227) at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:268) at org.springframework.ldap.LdapTemplate.search(LdapTemplate.java:231)
We get back a really lot of attributes also some "binary" like certificates, could this be a possible problem ?
Have anyone an idea, we have to solve the problem very quick.
Thanks a lot.
Regards


Reply With Quote