Results 1 to 3 of 3

Thread: Failed to borrow DirContext from pool. in 1.3.1.RELEASE

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    10

    Default Failed to borrow DirContext from pool. in 1.3.1.RELEASE

    Hi

    Have just upgraded from 1.3.1.RELEASE to 1.3.1.RELEASE on account of wanting to use LdapTemplate.authenticate().

    Now my integration test all fail with:

    Code:
    org.springframework.dao.DataAccessResourceFailureException: Failed to borrow DirContext from pool.; nested exception is java.util.NoSuchElementException: Could not create a validated object, cause: ValidateObject failed
    	at org.springframework.ldap.pool.factory.PoolingContextSource.getContext(PoolingContextSource.java:425)
    	at org.springframework.ldap.pool.factory.PoolingContextSource.getReadWriteContext(PoolingContextSource.java:408)
    	at org.springframework.ldap.core.LdapTemplate.executeReadWrite(LdapTemplate.java:801)
    Could not create a validated object, cause: ValidateObject failed
    Do I need to set config in a different way ? Am i missing some fundamental part of the setup?
    Code:
    <bean id="ldapPropertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    	<property name="location" value="classpath:gcd-ldap-${environment}.properties" />
    </bean> 
    
    <bean id="dirContextValidator"
    	class="org.springframework.ldap.pool.validation.DefaultDirContextValidator">
    	<property name="base" value="o=nomura.com"></property>
    	<property name="filter" value="cn=*"></property>
    </bean>
    
    <bean id="abstractPool" class="org.springframework.ldap.pool.factory.PoolingContextSource">
    	<property name="contextSource" ref="ldapContextSource"/>
    	<property name="dirContextValidator" ref="dirContextValidator"/>
    	<property name="testOnBorrow" value="true"/>
    	<property name="testWhileIdle" value="true"/>
    </bean>
    
     name="testOnBorrow" value="true"></property>
    	</bean-->
    
    <bean id="ldapContextSource" class="org.springframework.ldap.core.support.LdapContextSource">
    	<property name="url" value="${ldap.url}" />
    	<property name="userDn" value="${ldap.username}" />
    	<property name="password" value="${ldap.password}" />
    	<property name="pooled" value="false" />
    </bean>
    Thanks in advance

  2. #2
    Join Date
    Apr 2008
    Posts
    15

    Default

    Were you ever able to get around this issue? I have the exact problem.

    Thanks,
    Sean

  3. #3
    Join Date
    Sep 2012
    Posts
    2

    Default

    I got the exact same error when I added

    <property name="testOnBorrow" value="true"/>

    to configuration url. I get a warning before the exception:

    WARN [org.springframework.ldap.pool.validation.DefaultDi rContextValidator] -
    DirContext 'javax.naming.ldap.InitialLdapContext@d150d15' failed validation with an
    exception.javax.naming.OperationNotSupportedExcept ion: [LDAP: error code 53 - Unwilling To Perform];
    Remaining name: ''

    I suppose Spring performs a request to the LDAP server to check if the connection it's still active and that this request is not considered valid by my ldap server. I just don't know what I need to change to fix that.

    Any help is appreciated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •