Results 1 to 3 of 3

Thread: Already value for key, JPA Entity manager?

  1. #1
    Join Date
    Jan 2008
    Location
    USA, Southeastern MN
    Posts
    37

    Question Already value for key, JPA Entity manager?

    I have an application that is using Spring 3.0.2 and Hibernate 3.5.3 throwing a strange error, but only on the production server! The application uses both a JPA transaction manager and a JDBC transaction manager. The JPA Entities are marked with the @Persistence and @PersistenceUnit annotations. Attached are my config files for the database and related entity managers. I can't for the life of me understand how this is only happening in one environment. The environment that this is not working in was "cloned" from an environment that does work.

    Any/all replies appreciated!


    Code:
     
    org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.jdbc.datasource.ConnectionHolder@e7c8865] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@52a53948] bound to thread [http-10.12.15.69-8080-1]
    	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:382)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:317)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
    	at com.donaldson.pw.service.impl.SystemInfoServiceImpl$$EnhancerByCGLIB$$17708490.getSystemInfo(<generated>)
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2008
    Location
    USA, Southeastern MN
    Posts
    37

    Default

    Bump, no ideas or suggestions on where I should start debugging this?

  3. #3
    Join Date
    Jan 2008
    Location
    USA, Southeastern MN
    Posts
    37

    Exclamation If I remove the tx advice the problem disappears

    In the sake of eliminating variables, I removed the following tx advice related sections from my spring config files:
    Code:
    	<tx:advice id="jpa-txAdvice" transaction-manager="jpa-transactionManager">
    		<tx:attributes>
    			<tx:method name="get*" read-only="true" />
    			<tx:method name="find*" read-only="true" />
    			<tx:method name="load*" read-only="true" />
    			<tx:method name="*" propagation="REQUIRES_NEW" rollback-for="CommercialComplianceException" />
    		</tx:attributes>
    	</tx:advice>
    	<aop:config proxy-target-class="true">
    		<aop:pointcut id="jpa-txAdvisor" expression="execution(* com.donaldson.pw.service.*.*(..))" />
    		<aop:advisor advice-ref="jpa-txAdvice" pointcut-ref="jpa-txAdvisor" />
    	</aop:config>
    	<aop:config proxy-target-class="true">
    		<aop:pointcut id="jpa-utilAdvisor" expression="execution(* com.donaldson.pw.utilities.*.*(..))" />
    		<aop:advisor advice-ref="jpa-txAdvice" pointcut-ref="jpa-utilAdvisor" />
    	</aop:config>
    The problem disappears. I also tried changing the propigation from REQUIRES_NEW to REQUIRED, but the problem still persists. If I don't have tx advice on my spring managed services, I loose the declarative transaction management, don't I? This seems to be a problem only when I include the advice. Can anyone explain why this is happening? Any/all replies are appreciated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •