legacy-knowledge-base
Publicado Sep. 25, 2010

'Pre-bound JDBC Connection found!' exception

written-by

Sergio Alonso

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • We have some custom modules using a common external DataSource.
  • When module A calls module B within a database transaction, following exception is raised:
org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:484)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:400)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.start(DefaultTransactionExecutor.java:139)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:64)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
at com.liferay.change.tracking.internal.aop.CTTransactionAdvice.invoke(CTTransactionAdvice.java:80)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
.
.
.

 

Environment

  • DXP 7.3

Resolution

  • Liferay DXP uses a unique HibernateTransactionManager, which is configured based on a HibernateSessionFactory and a LiferayDataSource.

  • In this user case, there is an additional external DataSource (different from LiferayDataSource) shared by 'n' modules.

And every module has its own Session Factory and its own Transaction Manager, giving as a result 'n' Transaction Managers sharing a unique DataSource.

Additional Information

 

 

did-this-article-resolve-your-issue

legacy-knowledge-base