Atomikos Forum

PostGres : Prepared Transaction does not exist

Hello,
 I'm trying to use Atomikos for a two phase commit over ActiveMQ and Postgres(Hibernate).
 
 My Environment : PostGres 8.4, Hibernate 3.6.5, Spring 3.0.5, ActiveMQ 5.5
 
 I ran a JUnit Test that just inserts a record into a table and I ran into this error. I googled and searched the forums a bit but I can't seem to figure out a way to fix it. Can you please help? I would really appreciate any inputs. Thanks.
 
 Hibernate: insert into someschema.locks (attempts, created_date, file_name, host_name, ip_address, modified_date, spring_guid, status, version, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2011-08-30 15:31:04,652 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,652 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,652 atomikos INFO : addParticipant ( XAResourceTransaction: 31302E31302E302E3137352E746D30303030313030303136:31302E31302E302E3137352E746D31 ) for transaction 10.10.0.175.tm0000100016
2011-08-30 15:31:04,652 atomikos INFO : XAResource.start ( 31302E31302E302E3137352E746D30303030313030303136:31302E31302E302E3137352E746D31 , XAResource.TMJOIN ) on resource XADBMS represented by XAResource instance org.postgresql.xa.PGXAConnection@dfb22b
2011-08-30 15:31:04,652 atomikos INFO : registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@c977de5a ) for transaction 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 org.hibernate.jdbc.AbstractBatcher DEBUG : Executing batch size: 1
2011-08-30 15:31:04,668 org.hibernate.jdbc.AbstractBatcher DEBUG : about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2011-08-30 15:31:04,668 org.hibernate.jdbc.ConnectionManager DEBUG : skipping aggressive-release due to flush cycle
2011-08-30 15:31:04,668 org.hibernate.jdbc.ConnectionManager DEBUG : aggressively releasing JDBC connection
2011-08-30 15:31:04,668 org.hibernate.jdbc.ConnectionManager DEBUG : releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos INFO : XAResource.end ( 31302E31302E302E3137352E746D30303030313030303136:31302E31302E302E3137352E746D31 , XAResource.TMSUCCESS ) on resource XADBMS represented by XAResource instance org.postgresql.xa.PGXAConnection@dfb22b
2011-08-30 15:31:04,668 org.springframework.orm.hibernate3.SessionFactoryUtils DEBUG : Closing Hibernate Session
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 org.springframework.transaction.jta.JtaTransactionManager DEBUG : Initiating transaction commit
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos DEBUG : getCompositeTransaction()  returning instance with id 10.10.0.175.tm0000100016
2011-08-30 15:31:04,668 atomikos INFO : commit() done (by application) of transaction 10.10.0.175.tm0000100016
2011-08-30 15:31:04,683 atomikos DEBUG : About to call prepare on XAResource instance: org.postgresql.xa.PGXAConnection@dfb22b
2011-08-30 15:31:04,683 atomikos INFO : XAResource.rollback ( 31302E31302E302E3137352E746D30303030313030303136:31302E31302E302E3137352E746D31 ) on resource XADBMS represented by XAResource instance org.postgresql.xa.PGXAConnection@dfb22b
2011-08-30 15:31:04,683 atomikos WARN : XA resource 'XADBMS': rollback for XID '31302E31302E302E3137352E746D30303030313030303136:31302E31302E302E3137352E746D31' raised -3: the XA resource detected an internal error
org.postgresql.xa.PGXAException: Error rolling back prepared transaction
    at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:357)
    at com.atomikos.datasource.xa.XAResourceTransaction.rollback(XAResourceTransaction.java:690)
    at com.atomikos.icatch.imp.RollbackMessage.send(RollbackMessage.java:72)
    at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:111)
    at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:87)
    at com.atomikos.icatch.imp.Propagator.submitPropagationMessage(Propagator.java:66)
    at com.atomikos.icatch.imp.CoordinatorStateHandler.rollback(CoordinatorStateHandler.java:746)
    at com.atomikos.icatch.imp.ActiveStateHandler.prepare(ActiveStateHandler.java:218)
    at com.atomikos.icatch.imp.CoordinatorImp.prepare(CoordinatorImp.java:832)
    at com.atomikos.icatch.imp.CoordinatorImp.terminate(CoordinatorImp.java:1159)
    at com.atomikos.icatch.imp.CompositeTerminatorImp.commit(CompositeTerminatorImp.java:92)
    at com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:236)
    at com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:498)
    at com.atomikos.icatch.jta.UserTransactionImp.commit(UserTransactionImp.java:129)
    at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy11.call(Unknown Source)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:206)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:201)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier "1096044365_MTAuMTAuMC4xNzUudG0wMDAwMTAwMDE2_MTAuMTAuMC4xNzUudG0x" does not exist
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
    at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:347)
    ... 36 more
 

 
My Configuration : (I've not included ActiveMQ configuration here since it's not being used by my test case)
-------------------


    <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close">
        <property name="forceShutdown"><value>true</value></property>
    </bean>
    
    <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
        <property name="transactionTimeout"><value>300</value></property>
    </bean>
    
    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    
        <property name="transactionManager"><ref bean="atomikosTransactionManager"  /></property>
        <property name="userTransaction"><ref bean="atomikosUserTransaction"  /></property>
    </bean>

    <bean id="xaDataSource"
          class="com.atomikos.jdbc.AtomikosDataSourceBean"
          init-method="init" destroy-method="close">
          <!-- set an arbitrary but unique name for the datasource -->
          <property name="uniqueResourceName"><value>XADBMS</value></property>
          <property name="xaDataSourceClassName">
            <value>org.postgresql.xa.PGXADataSource</value>
          </property>
          <property name="xaProperties">
                    <props>
                            <prop key="user">${DB_USER:test_admin}</prop>
                            <prop key="password">${DB_PASS:password}</prop>
                            <prop key="serverName">${DB_SERVER:localhost}</prop>
                            <prop key="portNumber">${DB_PORT:5432}</prop>
                            <prop key="databaseName">${DB_NAME:test}</prop>
                    </props>
          </property> 
          <property name="poolSize" value="10"/>
    </bean>
    
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        
        <property name="packagesToScan" ref="packagesToScan" />
        <property name="dataSource" ref="xaDataSource" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory</prop>
                <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">validate</prop>
                <prop key="hibernate.generate_statistics">true</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
                <prop key="hibernate.cache.use_structured_entries">true</prop>
            </props>
        </property>
    
    </bean>
Kiwiland Send private email
Tuesday, August 30, 2011
 
 
Let me check with our Postgres contacts.
Guy Pardon Send private email
Friday, September 02, 2011
 
 
Having a very similar problem. This appears to be related to these other posts:

 default82df.html?community.6.1918.14
 default82df.html?community.6.1503.7

As far as I can tell Atomikos just does not work with Postgre  XA at all? A shame but such is life.

We are using Bitronix at the moment.
Shane Paul Send private email
Tuesday, September 20, 2011
 
 
We did run our XA test compatibility kit with PostgreSQL so either this is a config problem or a bug that is triggered in this specific scenario.

Either way, I created a case to look at it. This might take a while (too much work going on), unless some support customer increases priority.

Thanks
Guy Pardon Send private email
Wednesday, September 21, 2011
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics