I have the following simple method in my DAO:
If transaction propagation for this method is set to "NOT_SUPPORTED", then it works and finds the right context. But if I set it to "REQUIRES_NEW", I am getting the following exception:Code:public void find() { DirContextAdapter context = (DirContextAdapter)getSimpleLdapTemplate().lookupContext("cn=Charles Zhao"); System.out.println("Found: " + context); }
java.lang.IllegalStateException: No value for key [org.springframework.ldap.core.support.LdapContextS ource@1aa0e3b] bound to thread [main]
at org.springframework.transaction.support.Transactio nSynchronizationManager.unbindResource(Transaction SynchronizationManager.java:184)
at org.springframework.transaction.compensating.suppo rt.AbstractCompensatingTransactionManagerDelegate. doCleanupAfterCompletion(AbstractCompensatingTrans actionManagerDelegate.java:119)
at org.springframework.ldap.transaction.compensating. manager.ContextSourceTransactionManager.doCleanupA fterCompletion(ContextSourceTransactionManager.jav a:133)
at org.springframework.transaction.support.AbstractPl atformTransactionManager.cleanupAfterCompletion(Ab stractPlatformTransactionManager.java:919)
at org.springframework.transaction.support.AbstractPl atformTransactionManager.processCommit(AbstractPla tformTransactionManager.java:712)
at org.springframework.transaction.support.AbstractPl atformTransactionManager.commit(AbstractPlatformTr ansactionManager.java:632)
at org.springframework.transaction.interceptor.Transa ctionAspectSupport.commitTransactionAfterReturning (TransactionAspectSupport.java:314)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:117)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :161)
Has anyone had similar issue?
Thanks,
Chunyun Zhao


Reply With Quote