Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Atomikos: exception when transaction contains more than one persist

I'm experimenting with standalone JPA and JTA / XA transaction management provided by Atomikos.

My simple unit test persists 3 records, wrapped in a JTA UserTransaction.

When using H2 as backing database, the test works fine.

When using MySQL as the backing database, the second persist throws this exception:

com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)

(see full stack trace and logging below). The log file gives more detail:

WARNING: XA resource 'jdbc/mysqlDs': resume for XID '3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32' raised -5: invalid arguments were given for the XA operation

If I leave only a single persist in the test, it succeeds. The same test also succeeds when using H2 instead of MySQL.

So question: what could be the cause of the exception in the case of MySQL?

Here is the main test code from JtaJpaMySQLAtomikosTest.java:

  @Test
  public void testSingleCommitMySql() throws Exception {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("javaee7.standalone.jta.pu_mysql");
    EntityManager em = emf.createEntityManager();

    UserTransaction userTransaction = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
    userTransaction.begin();

    em.joinTransaction();
    em.persist(new TestEntity("FOO", "A"));
    em.persist(new TestEntity("BAR", "B"));
    em.persist(new TestEntity("BAZ", "C"));

    em.flush();
    userTransaction.commit();

    TypedQuery<TestEntity> query = em.createQuery("SELECT b FROM TestEntity b WHERE name = :name", TestEntity.class)
        .setParameter("name", "FOO");

    assertEquals("A", query.getSingleResult().getValue());

    em.close();
    emf.close();
  }

If you need the full test code, let me know.

Here's the relevant portion of the logging + exception:

INFO: AtomikosDataSoureBean 'jdbc/mysqlDs': getConnection ( null )...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: AtomikosDataSoureBean 'jdbc/mysqlDs': init...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling getAutoCommit...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling getMetaData...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling createStatement...
Apr 28, 2016 12:34:57 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000396: Updating schema
Apr 28, 2016 12:34:57 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000261: Table found: twophasepoc.testentity
Apr 28, 2016 12:34:57 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000037: Columns: [name, id, value]
Apr 28, 2016 12:34:57 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000108: Foreign keys: []
Apr 28, 2016 12:34:57 PM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000126: Indexes: [primary]
Apr 28, 2016 12:34:57 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling getWarnings...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling clearWarnings...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: close()...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: createCompositeTransaction ( 10000 ): created new ROOT transaction with id 192.168.14.117.tm0000200081
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@4e517165 ) for transaction 192.168.14.117.tm0000200081
Hibernate: 
    insert 
    into
        TestEntity
        (name, value) 
    values
        (?, ?)
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: AtomikosDataSoureBean 'jdbc/mysqlDs': getConnection ( null )...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: AtomikosDataSoureBean 'jdbc/mysqlDs': init...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: addParticipant ( XAResourceTransaction: 3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32 ) for transaction 192.168.14.117.tm0000200081
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: XAResource.start ( 3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32 , XAResource.TMNOFLAGS ) on resource jdbc/mysqlDs represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection@16ecee1
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@35a707b3 ) for transaction 192.168.14.117.tm0000200081
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling prepareStatement(insert into TestEntity (name, value) values (?, ?),1)...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: isClosed()...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling getWarnings...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: calling clearWarnings...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@1bb266b3: close()...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: XAResource.end ( 3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32 , XAResource.TMSUCCESS ) on resource jdbc/mysqlDs represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection@16ecee1
Hibernate: 
    insert 
    into
        TestEntity
        (name, value) 
    values
        (?, ?)
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: AtomikosDataSoureBean 'jdbc/mysqlDs': getConnection ( null )...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: AtomikosDataSoureBean 'jdbc/mysqlDs': init...
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: addParticipant ( XAResourceTransaction: 3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32 ) for transaction 192.168.14.117.tm0000200081
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: XAResource.start ( 3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32 , XAResource.TMJOIN ) on resource jdbc/mysqlDs represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection@16ecee1
Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logWarning
WARNING: XA resource 'jdbc/mysqlDs': resume for XID '3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32' raised -5: invalid arguments were given for the XA operation
com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:581)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:566)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:507)
    at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:427)
    at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:59)
    at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:64)
    at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:88)
    at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:179)
    at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:223)
    at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:142)
    at com.sun.proxy.$Proxy12.prepareStatement(Unknown Source)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$2.doPrepare(StatementPreparerImpl.java:124)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:122)
    at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.prepare(IdentityGenerator.java:89)
    at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:55)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3556)
    at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:97)
    at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:480)
    at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:191)
    at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:175)
    at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:210)
    at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:324)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:194)
    at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
    at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:84)
    at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:206)
    at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:149)
    at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:75)
    at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:807)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:780)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:785)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1181)
    at JtaJpaMySQLAtomikosTest.testSingleCommitMySql(JtaJpaMySQLAtomikosTest.java:88)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.sql.SQLException: XAER_INVAL: Invalid arguments (or unsupported command)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2547)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2505)
    at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:560)
    ... 60 more

Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logWarning
WARNING: Error enlisting in transaction - connection might be broken? Please check the logs for more information...
com.atomikos.datasource.ResourceException: XA resource 'jdbc/mysqlDs': resume for XID '3139322E3136382E31342E3131372E746D30303030323030303831:3139322E3136382E31342E3131372E746D32' raised -5: invalid arguments were given for the XA operation
    at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:434)
    at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:59)
    at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:64)
    at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:88)
    at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:179)
    at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:223)
    at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:142)
    at com.sun.proxy.$Proxy12.prepareStatement(Unknown Source)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$2.doPrepare(StatementPreparerImpl.java:124)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:122)
    at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.prepare(IdentityGenerator.java:89)
    at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:55)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3556)
    at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:97)
    at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:480)
    at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:191)
    at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:175)
    at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:210)
    at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:324)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:194)
    at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
    at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:84)
    at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:206)
    at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:149)
    at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:75)
    at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:807)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:780)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:785)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1181)
    at JtaJpaMySQLAtomikosTest.testSingleCommitMySql(JtaJpaMySQLAtomikosTest.java:88)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Apr 28, 2016 12:34:57 PM com.atomikos.logging.JULLogger logInfo
INFO: setRollbackOnly() called for transaction 192.168.14.117.tm0000200081

Here's the persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">
    <persistence-unit name="javaee7.standalone.jta.pu_mysql" transaction-type="JTA">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <jta-data-source>jdbc/mysqlDs</jta-data-source>
        <class>TestEntity</class>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.transaction.jta.platform" value="AtomikosJtaPlatform"/>
        </properties>
    </persistence-unit>
</persistence>
like image 976
geert3 Avatar asked Apr 28 '16 10:04

geert3


1 Answers

The is could be for MySQL server limitation of XA support, https://dev.mysql.com/doc/refman/5.5/en/xa-statements.html

Also might be for the known problem of atomikos https://www.atomikos.com/Documentation/KnownProblems#ActiveMQ_error:_34Transaction_39XID:..._39_has_not_been_started_34

this could be a solution https://www.atomikos.com/Documentation/NonXaDataSource

Refer to geert3 comment below for more specific solution.

Following links can be explored

https://community.oracle.com/thread/2326795 http://fogbugz.atomikos.com/default.asp?community.6.3215.2

like image 92
Syed Ekram Uddin Avatar answered Sep 22 '22 17:09

Syed Ekram Uddin