Hi,
I've implemented the transaction manager but it still fails - in fact, the LDAP query fails on the second attrempt, without fail. This is actually worse than not using the transaction manager as it did at least do a few iterations before failing! Here's the exception:
Code:
Caused by: javax.naming.CommunicationException: [LDAP: error code 2 - 00000057: LdapErr: DSID-0C09068F, comment: Error processing control, data 0, vece
at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:98)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:295)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:234)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:548)
I've debugged the transaction manager and I can see TransactionAwareDirContextInvocationHandler being invoked, catching the close method, calling doCloseTransaction and calling this:
Code:
} else {
log.debug("Leaving transactional context open");
}
So it would appear I've set it up correctly. However here is the Spring configuration:
Code:
<bean id="contextSource" class="org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy">
<constructor-arg ref="datasource.ldap" />
</bean>
<bean id="transactionManager"
class="org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManager">
<property name="contextSource" ref="contextSource"/>
</bean>
<!-- LDAP template to use with the LDAP datasource -->
<bean id="global.ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>
<!-- User management DAO -->
<bean id="global.ldap.xx.userManagementDAO.target"
class="com.xx.dao.ldap.UserManagementDAO">
<property name="ldapTemplate" ref="global.ldapTemplate"/>
<!-- BaseDN is RELATIVE to datasource base -->
<property name="baseDn" value="ou=GLB" />
</bean>
<bean id="global.ldap.xx.userManagementDAO"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target" ref="global.ldap.xx.userManagementDAO.target" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRES_NEW</prop>
</props>
</property>
</bean>
Do you have any further thoughts? Is it possible our LDAP doesn't support multiple queries in one connection?
John