Announcement Announcement Module
Collapse
No announcement yet.
Cannot call setRequestControls on a pooled context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot call setRequestControls on a pooled context

    Hello
    Guys

    Ive been trying to understand how to search on springldap with page results but Im stucked here

    Code:
    Cannot call setRequestControls on a pooled context
    Is it a issue of springldap or commons-pool?

    Im using Oracles LDAP OID 11g.

    Thanks
    Raphael Milani
    Last edited by ramilani12; Dec 23rd, 2011, 02:10 PM.

  • #2
    Hi

    I know it's too late to response. However just in case if anyone encounter the same issue, please use below solution.

    You need to use "org.springframework.ldap.pool.factory.MutablePool ingContextSource" in order to create a pool which provides "org.springframework.ldap.pool.MutableDelegatingLd apContext" to set RequestControls.

    Below is the full context configuration with annotation based transaction management.

    <!-- Annotation driven transaction management -->
    <context:annotation-config />

    <tx:annotation-driven proxy-target-class="true" transaction-manager="ldap_tx_manager" />

    <!-- LDAP Context Source -->
    <bean id="contextSourceTarget" class="org.springframework.ldap.core.support.LdapC ontextSource">
    <property name="url" value="${ldap.url}"/>
    <property name="base" value="${ldap.base}" />
    <property name="userDn" value="${ldap.userDn}"/>
    <property name="password" value="${ldap.password}"/>
    <property name="pooled" value="false"/>
    </bean>

    <!-- Connection Pool for LDAP Control support-->
    <bean id="pooledContextSource" class="org.springframework.ldap.pool.factory.Mutab lePoolingContextSource">
    <property name="contextSource" ref="contextSourceTarget"/>
    <property name="dirContextValidator" ref="dirContextValidator"/>
    <property name="testOnBorrow" value="true"/>
    <property name="testWhileIdle" value="true"/>
    <property name="minIdle" value="${ldap.minIdle}"/>
    <property name="maxIdle" value="${ldap.maxIdle}"/>
    <property name="maxActive" value="${ldap.maxActive}"/>
    <property name="maxTotal" value="${ldap.maxTotal}"/>
    <property name="maxWait" value="${ldap.maxWait}"/>
    </bean>

    <bean id="dirContextValidator"
    class="org.springframework.ldap.pool.validation.De faultDirContextValidator"/>

    <bean id="contextSource"
    class="org.springframework.ldap.transaction.compen sating.manager.TransactionAwareContextSourceProxy" >
    <constructor-arg ref="pooledContextSource"/>
    </bean>

    <bean id="ldap_tx_manager" class="org.springframework.ldap.transaction.compen sating.manager.ContextSourceTransactionManager" >
    <property name="contextSource" ref="contextSourceTarget" />
    </bean>

    <!-- LDAP access template and odm manager -->
    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
    <property name="contextSource" ref="contextSource"/>
    </bean>

    Comment

    Working...
    X