I am stuck with this exception for the last 4 days and almost giving up.. If I can't fix this, I will have to go back to Spring 3.1 with Hibernate 3.x, but I desperately want to move forward to Spring 3.1.2 and Hibernate 4.1 instead.
I found many threads complaining about the same issue and most of the solutions prescribed were to checkand avoid multiple occurrence of these and to place them in the right context (Web/other context-config files) and to placeCode:<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="false"/> <context:annotation-config/> <context:component-scan base-package="com.li"/>in your Service (I have also added this to my DAO but still in vain). I did all of those. After extensive debugging and looking at Spring source, I followed the trace logs and wondering where to go next. Here's my logs..Code:@Transactional(readOnly = true, propagation = Propagation.REQUIRED)
I see thatCode:INFO] [talledLocalContainer] TRACE [http-bio-8080-exec-2] SessionImpl.setFlushMode(1363) | Setting flush mode to: MANUAL [INFO] [talledLocalContainer] DEBUG [http-bio-8080-exec-2] TransactionSynchronizationManager.bindResource(193) | Bound value [org.springframework.orm.hibernate4.SessionHolder@4adfa73f] for key [org.hibernate.internal.SessionFactoryImpl@2f4e80a4] to thread [http-bio-8080-exec-2] [INFO] [talledLocalContainer] DEBUG [http-bio-8080-exec-2] TransactionSynchronizationManager.getResource(140) | Retrieved value [org.springframework.orm.hibernate4.SessionHolder@4adfa73f] for key [org.hibernate.internal.SessionFactoryImpl@2f4e80a4] bound to thread [http-bio-8080-exec-2] [INFO] [talledLocalContainer] DEBUG [http-bio-8080-exec-2] TransactionSynchronizationManager.bindResource(193) | Bound value [org.springframework.jdbc.datasource.ConnectionHolder@1b26493f] for key [org.apache.commons.dbcp.BasicDataSource@11374c2] to thread [http-bio-8080-exec-2] [INFO] [talledLocalContainer] DEBUG [http-bio-8080-exec-2] TransactionSynchronizationManager.initSynchronization(272) | Initializing transaction synchronization [INFO] [talledLocalContainer] ERROR [http-bio-8080-exec-2] UserDaoHibernate.find(256) | org.hibernate.HibernateException: No Session found for current thread [WARNING] [talledLocalContainer] org.hibernate.HibernateException: No Session found for current thread [WARNING] [talledLocalContainer] at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97) [WARNING] [talledLocalContainer] at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:941) [WARNING] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [WARNING] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [WARNING] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [WARNING] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:601) [WARNING] [talledLocalContainer] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) [WARNING] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [WARNING] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [WARNING] [talledLocalContainer] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) [WARNING] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [WARNING] [talledLocalContainer] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [WARNING] [talledLocalContainer] at $Proxy50.getCurrentSession(Unknown Source) [WARNING] [talledLocalContainer] at com.li.base.dao.hibernate.GenericDaoHibernate.find(GenericDaoHibernate.java:245) [WARNING] [talledLocalContainer] at com.li.common.dao.hibernate.UserDaoHibernate.loadUserByUsername(UserDaoHibernate.java:84)returning a "org.springframework.orm.hibernate4.SessionHol der" instance, but "org.springframework.orm.hibernate4.SpringSessionC ontext" only seem to throw this exception @ line 97, instead of handling the logic block from line 70 to 88 of "else if (value instanceof SessionHolder) {".Code:[INFO] [talledLocalContainer] DEBUG [http-bio-8080-exec-2] TransactionSynchronizationManager.getResource(140) | Retrieved value [org.springframework.orm.hibernate4.SessionHolder@4adfa73f] for key [org.hibernate.internal.SessionFactoryImpl@2f4e80a4] bound to thread [http-bio-8080-exec-2]
Please help!!!


Reply With Quote