-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Spring + Hibernate transaction issue
PostPosted: Mon Feb 20, 2017 2:37 am 
Newbie

Joined: Mon Feb 20, 2017 2:15 am
Posts: 1
We have a restful web application built on Spring + Hibernate framework. It is using multiple datasources and transaction manager for each of the datasource is set as org.springframework.orm.hibernate4.HibernateTransactionManager. All these are chained together in org.springframework.data.transaction.ChainedTransactionManager. We are enabling transaction using <tx:annotation-driven transaction-manager="transactionManager" /> and @Transactional annotations. Now the problem is that in one of our modules we are facing an exception as soon as a few requests are made. The exception stack is given below. This module is not using the default transactionManager, so we have explicitly set which transaction manager to use in @Transactional(value=”<moduleSpecificTransactionManager”). Has anyone come across this issue and found a solution for it?
The version of hibernate and spring we are using are

hibernate.core.version - 4.3.11.Final
hibernate.annotations.versions - 3.4.0.GA
hibernate.validator.version - 5.1.1.Final
spring.version - 4.2.0.RELEASE

Exception Trace:
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate4.SessionHolder@67c4bb38] for key [org.hibernate.internal.SessionFactoryImpl@16776931] bound to thread [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)']; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate4.SessionHolder@67c4bb38] for key [org.hibernate.internal.SessionFactoryImpl@16776931] bound to thread [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)']
at org.springframework.data.transaction.ChainedTransactionManager.getTransaction(ChainedTransactionManager.java:122)
at org.springframework.data.transaction.ChainedTransactionManager.getTransaction(ChainedTransactionManager.java:51)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:427)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate4.SessionHolder@67c4bb38] for key [org.hibernate.internal.SessionFactoryImpl@16776931] bound to thread [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)']
at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:544)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at org.springframework.data.transaction.MultiTransactionStatus.registerTransactionManager(MultiTransactionStatus.java:68)
at org.springframework.data.transaction.ChainedTransactionManager.getTransaction(ChainedTransactionManager.java:101)
... 77 more
Caused by: java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate4.SessionHolder@67c4bb38] for key [org.hibernate.internal.SessionFactoryImpl@16776931] bound to thread [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)']
at org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:190)
at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:524)
... 80 more


Top
 Profile  
 
 Post subject: Re: Spring + Hibernate transaction issue
PostPosted: Mon Feb 20, 2017 4:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Looks like a Spring configuration issue. Try asking the question on the Spring forum as well. They surely know it better.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.