Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: HibernateTransactionManager.doBegin fails with java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder [SPR-6409] #11075

Closed
spring-projects-issues opened this issue Nov 22, 2009 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Axel Fontaine opened SPR-6409 and commented

Note: This works perfectly in 2.5.6 with the same Hibernate version.

In HibernateTransactionManager.doBegin() line 555 (hibTx = session.beginTransaction();) results in a call to TransactionSynchronizationManager.bindResource with the following arguments:
key = the datasource
value = connection holder

So far so good.

Execution of HibernateTransactionManager.doBegin() then resumes until line 571 (TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);) which then bombs out on line 179 with java.lang.IllegalStateException: Already value !

This is a serious regression that should definitely be fixed before 3.0 goes final.

Keep up the good work,
Axel (going back to 2.5.6 until this is resolved)


Affects: 3.0 RC2

Referenced from: commits 5165465

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

How exactly does that session.beginTransaction call at line 555 result in a call to TransactionSynchronizationManager.bindResource? Are you by any chance using TransactionAwareDataSourceProxy or the like underneath, with your LocalSessionFactoryBean linked to it?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Axel Fontaine commented

This is my configuration:

<bean id="base-dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
.....
</bean>
<bean id="base-hibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="base-dataSource"/>
<property name="packagesToScan">...</property>
<property name="hibernateProperties">...</property>
<property name="namingStrategy">...</property>
<property name="useTransactionAwareDataSource" value="true"/>
</bean>
<bean id="base-hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="base-hibernateSessionFactory"/>
</bean>
<bean id="base-simpleJdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg ref="base-dataSource"/>
</bean>
<context:component-scan base-package="..." scoped-proxy="interfaces"/>
<bean id="base-transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="base-hibernateSessionFactory"/>
</bean>
<tx:annotation-driven transaction-manager="base-transactionManager"/>

This is used in conjunction with the Spring Test Framwork and a class annotated with:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"..."})
@TransactionConfiguration(transactionManager = "base-transactionManager")
@Transactional

It bombs out before reaching any code in my class.

Hope this helps,
Axel

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This was an accidental side effect of a stability enhancement in AbstractPlatformTransactionManager. Fixed for RC3 now. Thanks for raising this!

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants