NameNotFoundException when I switch from LdapContextSource to PoolingContextSource
My searches start throwing NameNotFoundException when I switch from LdapContextSource to PoolingContextSource, can someone help?
Exception:
ServiceInvocationError:org.springframework.ldap.Na meNotFoundException: [LDAP: error code 32 - No Such Object]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object];
Code:
result = ldapTemplate.search(base.toString(), andFilter.encode(), SearchControls.OBJECT_SCOPE, new String[] { "cn", "imCountry", "preferredLanguage", "preferredDeliveryMethod", "telephonenumber", "mail","imCompanyID" }, new AttributesMapper()
Configuration that works:
<beans:bean id="contextSourceTarget"
class="org.springframework.ldap.core.support.LdapC ontextSource">
<beans:property name="url" value="ldap://spogtamldap-ro:389" />
<beans:property name="userDn"
value="uid=tcserver-ro,ou=applications,dc=ironmountain,dc=com" />
<beans:property name="password" value="${TAM.LDAP.password}" />
<property name="dirObjectFactory" value="org.springframework.ldap.core.support.Defau ltDirObjectFactory" />
<property name="pooled" value="false" />
</beans:bean>
<beans:bean id="tamLdapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
<beans:constructor-arg ref="contextSourceTarget" />
</beans:bean>
Configuration that throws javax.naming.NameNotFoundException
<beans:bean id="contextSourceTarget"
class="org.springframework.ldap.core.support.LdapC ontextSource">
<beans:property name="url" value="ldap://spogtamldap-ro:389" />
<beans:property name="userDn"
value="uid=tcserver-ro,ou=applications,dc=ironmountain,dc=com" />
<beans:property name="password" value="${TAM.LDAP.password}" />
<property name="dirObjectFactory" value="org.springframework.ldap.core.support.Defau ltDirObjectFactory" />
<property name="pooled" value="false" />
</beans:bean>
<beans:bean id="contextSourcePooled" class="org.springframework.ldap.pool.factory.Pooli ngContextSource">
<beans:property name="contextSource" ref="contextSourceTarget" />
<property name="dirContextValidator" ref="dirContextValidator"/>
<beans:property name="maxActive" value="200" />
<beans:property name="maxIdle" value="200" />
<beans:property name="minIdle" value="10" />
<property name="testOnBorrow" value="true"/>
<property name="testWhileIdle" value="true"/>
</beans:bean>
<beans:bean id="tamLdapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
<beans:constructor-arg ref=" contextSourcePooled " />
</beans:bean>
<bean id="dirContextValidator" class="org.springframework.ldap.pool.validation.De faultDirContextValidator" />