java.lang.IllegalStateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • There appears to be a problem with release 1.1. I have a declarative transaction management configuration that works correctly in release 1.0.2, but crashes using release 1.1! The exception I am getting is: ------------------------------------------------ Could not create Hibernate transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] ------------------------------------------------ This exception appears as soon as I introduce a TransactionProxyFactoryBean for a POJO class (see applicationContext.xml snippet below). This exception is discussed in SPR-272 which discusses patches to release 1.1 RC2. I have verified that release 1.1 does indeed contain these patches in the source. Is it possible that these patches are somehow related to the failure I am experiencing in 1.1 ??? NOTE: The POJO ("JobService") is a simple delegate that dispatches to an underlying DAO. I have the following bean definitions (among others): ------------------------------------------------------------------------------------- <beans> <bean id="flipperDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>oracle.jdbc.driver.OracleDriver</value> </property> <property name="url"> <value>jdbc:oracle:thin:@XEM02DEV:1527:XEM02DEV</value> </property> <property name="username"> <value>******</value> </property> <property name="password"> <value>*********</value> </property> <property name="defaultAutoCommit"> <value>false</value> </property> </bean> <bean id="flipperSessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"><ref bean="flipperDataSource"/></property> <property name="mappingResources"> <list> <value>conf/hibernate/JobDto.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop> <!--<prop key="hibernate.show_sql">false</prop>--> </props> </property> </bean> <bean id="xactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="flipperSessionFactory"/> </property> </bean> <bean id="JobDaoTarget" class="com.xcel.flipper.persist.dao.hibernate.HibernateJobDao"> <property name="sessionFactory"> <ref bean="flipperSessionFactory"/> </property> </bean> <bean id="JobService" class="com.xcel.flipper.persist.dao.JobService"> <property name="jobDao"> <ref bean="JobDaoTarget"/> </property> </bean> <!-- Transactional Proxy --> <bean id="JobDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="xactionManager"/></property> <property name="target"><ref bean="JobService"/></property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> </beans> ----------------------------------------------------------------------------- When I added the Transactional Proxy (TransactionProxyFactoryBean show above), the unit test for a class using the JobDoa fails with the following error: ----------------------------------------------------------------------------- Testsuite: com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 7.187 sec Testcase: testActivityExectionLogCLOBField(com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest): Caused an ERROR Could not create Hibernate transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] org.springframework.transaction.CannotCreateTransactionException: Could not create Hibernate transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] at org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:137) at org.springframework.orm.hibernate.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:412) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:269) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:200) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:49) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy0.create(Unknown Source) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.createJob(ActivityExecutionLogTestService.java:84) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.initialize(ActivityExecutionLogTestService.java:55) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.runTest(ActivityExecutionLogTestService.java:139) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService$$FastClassByCGLIB$$73e1c0c5.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$MethodInvocationImpl.invokeJoinpoint(Cglib2AopProxy.java:878) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:596) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService$$EnhancerByCGLIB$$35ec6769.runTest(<generated>) at com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest.testActivityExectionLogCLOBField(ActivityExecutionLogDaoTest.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232) .......... -----------------------------------------------------------------------------
    via by Bob Johnson,
  • There appears to be a problem with release 1.1. I have a declarative transaction management configuration that works correctly in release 1.0.2, but crashes using release 1.1! The exception I am getting is: ------------------------------------------------ Could not create Hibernate transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] ------------------------------------------------ This exception appears as soon as I introduce a TransactionProxyFactoryBean for a POJO class (see applicationContext.xml snippet below). This exception is discussed in SPR-272 which discusses patches to release 1.1 RC2. I have verified that release 1.1 does indeed contain these patches in the source. Is it possible that these patches are somehow related to the failure I am experiencing in 1.1 ??? NOTE: The POJO ("JobService") is a simple delegate that dispatches to an underlying DAO. I have the following bean definitions (among others): ------------------------------------------------------------------------------------- <beans> <bean id="flipperDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>oracle.jdbc.driver.OracleDriver</value> </property> <property name="url"> <value>jdbc:oracle:thin:@XEM02DEV:1527:XEM02DEV</value> </property> <property name="username"> <value>******</value> </property> <property name="password"> <value>*********</value> </property> <property name="defaultAutoCommit"> <value>false</value> </property> </bean> <bean id="flipperSessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"><ref bean="flipperDataSource"/></property> <property name="mappingResources"> <list> <value>conf/hibernate/JobDto.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop> <!--<prop key="hibernate.show_sql">false</prop>--> </props> </property> </bean> <bean id="xactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="flipperSessionFactory"/> </property> </bean> <bean id="JobDaoTarget" class="com.xcel.flipper.persist.dao.hibernate.HibernateJobDao"> <property name="sessionFactory"> <ref bean="flipperSessionFactory"/> </property> </bean> <bean id="JobService" class="com.xcel.flipper.persist.dao.JobService"> <property name="jobDao"> <ref bean="JobDaoTarget"/> </property> </bean> <!-- Transactional Proxy --> <bean id="JobDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="xactionManager"/></property> <property name="target"><ref bean="JobService"/></property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> </beans> ----------------------------------------------------------------------------- When I added the Transactional Proxy (TransactionProxyFactoryBean show above), the unit test for a class using the JobDoa fails with the following error: ----------------------------------------------------------------------------- Testsuite: com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 7.187 sec Testcase: testActivityExectionLogCLOBField(com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest): Caused an ERROR Could not create Hibernate transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] org.springframework.transaction.CannotCreateTransactionException: Could not create Hibernate transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] at org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:137) at org.springframework.orm.hibernate.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:412) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:269) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:200) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:49) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy0.create(Unknown Source) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.createJob(ActivityExecutionLogTestService.java:84) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.initialize(ActivityExecutionLogTestService.java:55) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.runTest(ActivityExecutionLogTestService.java:139) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService$$FastClassByCGLIB$$73e1c0c5.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$MethodInvocationImpl.invokeJoinpoint(Cglib2AopProxy.java:878) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:596) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService$$EnhancerByCGLIB$$35ec6769.runTest(<generated>) at com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest.testActivityExectionLogCLOBField(ActivityExecutionLogDaoTest.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232) .......... -----------------------------------------------------------------------------
    via by Bob Johnson,
  • Spring & Hibernate: can not bind session.
    via Stack Overflow by Prevail
    ,
  • nested transactionTemplate
    via Stack Overflow by Jin Kim
    ,
    • java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@14e9851] for key [org.apache.commons.dbcp.BasicDataSource@4dd1b] bound to thread [main] at org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:137) at org.springframework.orm.hibernate.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:412) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:269) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:200) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:49) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy0.create(Unknown Source) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.createJob(ActivityExecutionLogTestService.java:84) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.initialize(ActivityExecutionLogTestService.java:55) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService.runTest(ActivityExecutionLogTestService.java:139) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService$$FastClassByCGLIB$$73e1c0c5.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$MethodInvocationImpl.invokeJoinpoint(Cglib2AopProxy.java:878) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:596) at com.xcel.flipper.persist.dao.ActivityExecutionLogTestService$$EnhancerByCGLIB$$35ec6769.runTest(<generated>) at com.xcel.flipper.persist.dao.ActivityExecutionLogDaoTest.testActivityExectionLogCLOBField(ActivityExecutionLogDaoTest.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,