5 Replies Latest reply on Dec 16, 2015 5:31 AM by simoncigoj

    Wildfly 8.1.0.Final: what this error mean:The command cannot be executed when global transaction is in the  IDLE state

    yangju

      After our app is switched from eap 6.0 to wildfly 8.1.0.Final, we keep getting this error.

       

      javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.

          at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1178) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)

          at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.endTransaction(TransactionalInterceptorBase.java:147) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:93) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:52) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source) [:1.7.0]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0]

          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0]

          at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

          at org.jboss.weld.interceptor.chain.AbstractInterceptionChain.invokeNext(AbstractInterceptionChain.java:103) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

          at org.jboss.weld.interceptor.chain.AbstractInterceptionChain.invokeNextInterceptor(AbstractInterceptionChain.java:81) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

          at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:48) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

          at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:41) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

          at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:53) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

          at com.pearson.epen.impl.service.auth.RestAuthServiceImpl$Proxy$_$$_WeldSubclass.authCheck(Unknown Source) [epen-common-1.5.2-SNAPSHOT.jar:]

          at com.pearson.epen.impl.service.auth.RestAuthServiceImpl$Proxy$_$$_WeldClientProxy.authCheck(Unknown Source) [epen-common-1.5.2-SNAPSHOT.jar:]

          at com.pearson.epen.tools.servlet.filter.EpenAuthFilter.execute(EpenAuthFilter.java:149) [epen-common-1.5.2-SNAPSHOT.jar:]

          at com.pearson.epen.tools.servlet.filter.AbstractHttpServletRequestFilter.doFilter(AbstractHttpServletRequestFilter.java:27) [epen-common-1.5.2-SNAPSHOT.jar:]

          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement

          at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.jpa.spi.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1882) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:115) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]

          ... 46 more

      Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement

          at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:190) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3285) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:159) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:349) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1222) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:110) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

          ... 52 more

      Caused by: java.sql.SQLException: XAER_RMFAIL: The command cannot be executed when global transaction is in the  IDLE state

          at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086)

          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)

          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)

          at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)

          at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)

          at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)

          at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)

          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2441)

          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2366)

          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2350)

          at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)

          at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:119)

          at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)

          at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:187) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]

       

       

       

       

      What does this error mean?

      Our example datasource config is like this:

       

      <xa-datasource jndi-name="java:jboss/datasources/xxxx" pool-name="xxxxx" enabled="true" use-java-context="true" use-ccm="true">

                          <xa-datasource-property name="URL">

                              jdbc:mysql://127.0.0.1:3306/xxxx?zeroDateTimeBehavior=convertToNull&amp;useUnicode=true&amp;connectionCollation=utf8_general_ci&amp;characterSetResults=utf8&amp;characterEncoding=utf8

                          </xa-datasource-property>

                          <driver>com.mysql</driver>

                          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                          <xa-pool>

                              <min-pool-size>1</min-pool-size>

                              <max-pool-size>50</max-pool-size>

                              <prefill>true</prefill>

                              <use-strict-min>true</use-strict-min>

                              <flush-strategy>IdleConnections</flush-strategy>

                              <is-same-rm-override>false</is-same-rm-override>

                              <pad-xid>false</pad-xid>

                              <wrap-xa-resource>true</wrap-xa-resource>

                          </xa-pool>

                          <security>

                              <user-name>xxxx</user-name>

                              <password>xxxx</password>

                          </security>

                          <validation>

                              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker"/>

                              <validate-on-match>true</validate-on-match>

                              <use-fast-fail>true</use-fast-fail>

                              <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.StaleConnectionChecker"/>

                              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>

                          </validation>

                          <statement>

                              <track-statements>TRUE</track-statements>

                              <prepared-statement-cache-size>100</prepared-statement-cache-size>

                              <share-prepared-statements>true</share-prepared-statements>

                          </statement>

                      </xa-datasource>

          ... 63 more

        • 1. Re: Wildfly 8.1.0.Final: what this error mean:The command cannot be executed when global transaction is in the  IDLE state
          yangju

          Some forums say that setting the pinGlobalTxToPhysicalConnection property to true in datasource config will fix this problem.  But what is the corresponding attribute in wildfly datasource configuraton? I could not find pinGlobalTxToPhysicalConnection in the mysql datasource config.

           

          It could be the problem was that for the same transaction, the same datasource get called multiple times. Mysql might not like this. Or it could be when the connection is being closed, some things happens.

           

          Either way we did not see this error when we were using jboss eap 6. This implies that the jca or resource manager change in wildfly are trigger this issue. Or it could be jboss eap's jca impl hid the problem.

          • 2. Re: Re: Wildfly 8.1.0.Final: what this error mean:The command cannot be executed when global transaction is in the  IDLE state
            garcimouche

            you can set the pinGlobalTxToPhysicalConnection property with a xa-datasource-property element:

             

                      <xa-datasource jndi-name="java:/xa_ca_dge" pool-name="mysql_xa_datasource" enabled="true" use-ccm="false">

                                <xa-datasource-property name="ServerName">

                                    localhost

                                </xa-datasource-property>

                                <xa-datasource-property name="DatabaseName">

                                    ca_dge

                                </xa-datasource-property>

                                <xa-datasource-property name="PinGlobalTxToPhysicalConnection">

                                    true

                                </xa-datasource-property>...

                                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>

                                <driver>mysql-connector-java-5.1.31.jar_com.mysql.jdbc.Driver_5_1</driver>

                                <xa-pool>

                                    <min-pool-size>1</min-pool-size>

                                    <max-pool-size>50</max-pool-size>

                                    <is-same-rm-override>false</is-same-rm-override>

                                    <interleaving>false</interleaving>

                                    <pad-xid>false</pad-xid>

                                    <wrap-xa-resource>true</wrap-xa-resource>

                                </xa-pool>

                                <security>

                                    <user-name>ca_dge</user-name>

                                    <password>ca_dge</password>

                                </security>

                                <validation>

                                  <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"></valid-connection-checker>

                                  <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"></exception-sorter>

                                </validation>                       

                                <statement>

                                    <track-statements>TRUE</track-statements>

                                    <prepared-statement-cache-size>100</prepared-statement-cache-size>

                                    <share-prepared-statements>true</share-prepared-statements>

                                </statement>               

                            </xa-datasource>


            However I tried and I also have the same problem as you described. Also using Wildfly 8.1.0.Final with JPA/Hibernate inside an EJB with CMT. I can't believe mysql xa is not working with Wildfly.

            • 3. Re: Wildfly 8.1.0.Final: what this error mean:The command cannot be executed when global transaction is in the  IDLE state
              simoncigoj

              I have the same problem, this error is happening randomly in my case. I have put the "PinGlobalTxToPhysicalConnection" to true in the datasources config but the error still happens.

               

              any other workarounds?

               

              My stack is:
              Wildfly 8.0.0. Final

              hibernate 4.3.1.Final

              mysql-connector-java-5.1.37

               

              I have 4 datasources participating in the transaction (don't ask why, it was a requirement):
              three of them are connecteing to 5.5.41-MariaDB-log MYSQL

              and one is connecting to 5.5.37-log MYSQL

               

              There is a bug report on mysql with the last response from 2010 and looks like not fixed yet.
              MySQL Bugs: #17343: XAConnection doesn't allow second XA START

              • 4. Re: Wildfly 8.1.0.Final: what this error mean:The command cannot be executed when global transaction is in the  IDLE state
                ctomc

                Simon Cigoj wrote:

                 

                I have the same problem, this error is happening randomly in my case. I have put the "PinGlobalTxToPhysicalConnection" to true in the datasources config but the error still happens.

                 

                any other workarounds?

                 

                My stack is:
                Wildfly 8.0.0. Final

                hibernate 4.3.1.Final

                mysql-connector-java-5.1.37

                 

                I have 4 datasources participating in the transaction (don't ask why, it was a requirement):
                three of them are connecteing to 5.5.41-MariaDB-log MYSQL

                and one is connecting to 5.5.37-log MYSQL

                 

                There is a bug report on mysql with the last response from 2010 and looks like not fixed yet.
                MySQL Bugs: #17343: XAConnection doesn't allow second XA START

                Well, maybe it would be time to upgrade to bit newer version of WildFly.

                8.0.0.Final had quite few know issues that ware fixed in later releases.

                I would suggest going directly to WF10, which has .Final release planed shortly. Or at least go for 9

                • 5. Re: Wildfly 8.1.0.Final: what this error mean:The command cannot be executed when global transaction is in the  IDLE state
                  simoncigoj

                  Upgraded to 8.2.0 Final via the patches ... look like it it works for now

                   

                  btw, 9.0 has no upgrade patch available? Are the patches only available between one major version?

                   

                  Will eventually upgrade to 9, but 8.2 looks working ok for now.