AnsweredAssumed Answered

Pre-bound JDBC Connection found! JpaTransactionManager does

Question asked by javatech on Apr 20, 2012
Hi,
while configuring tomcat datasouce iam facing the following issue.
help appriciated. thxs  in advance.

"org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! JpaTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single JpaTransactionManager for all transactions on a single DataSource, no matter whether JPA or JDBC access."


Persistance.xml

<persistence-unit name="activiti-jpa-pu" transaction-type="RESOURCE_LOCAL">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <jta-data-source>jdbc/activiti</jta-data-source>    
   </persistence-unit>

   
   activiti-cfg.xml
   —————–
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
   <property name="jndiName" value="java:/comp/env/jdbc/activiti" />
</bean>
   

<bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="dataSource" ref="dataSource" />
       <property name="persistenceUnitName" value="activiti-jpa-pu"/>
       <property name="persistenceXmlLocation">
            <value>classpath:META-INF/persistence.xml</value>
          </property>
      <property name="jpaVendorAdapter">
         <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
            <property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />
            <property name="showSql" value="true" />
         </bean>
      </property>
</bean>

Outcomes