1 2 Previous Next 24 Replies Latest reply on Apr 17, 2014 10:34 AM by Mark Little

    Wildfly jta transaction fails when datasources which are used for inserting. But only fails for the first time to be used.

    Richard Yang Apprentice

      In Wildfly 8.0.0.Final, our application's JTA transaction (two mysql datasources) got exception when one of the datasource is being used to do inserting into a table (native sql query through jpa):

      It throws exception such as IJ000461: Could not enlist in transaction on entering meta-aware object. I guess this is because some jta transaction property timeout is set too short by default? But I don't know which property I should adjust in the mysql datasource config. An example of our current jta datasource in standalone.xml is as follows.

       

      Interestingly, after the first failure, subsequent jta transactions are always successful.

      P.S. We do not have global transaction timeout override anywhere. Everything is default. Attachedd are standalone.xml and server log.

       

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

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

                              jdbc:mysql://127.0.0.1:3306/myDS?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>FailingConnectionOnly</flush-strategy>

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

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

                          </xa-pool>

                          <security>

                              <user-name>xxx</user-name>

                              <password>xxx</password>

                          </security>

                          <validation>

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

                              <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>

       

       

                     <drivers>

                 

                          <driver name="com.mysql" module="com.mysql">

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

                          </driver>

              

                      </drivers>

       

      Complete exception stacktrace:

      Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@5b3e902b[state=DESTROYED managed connection=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@558c8726 connection handles=0 lastUse=1394423601710 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@44b32228 mcp=SemaphoreArrayListManagedConnectionPool@6f1ca09a[pool=slave-1] xaResource=XAResourceWrapperImpl@4c879354[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@558c8726 pad=false overrideRmValue=null productName=MySQL productVersion=5.5.31-30.3-log jndiName=java:jboss/datasources/slave-1] txSync=null]

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:150)

          at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]

          at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]

          at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]

          ... 136 more

      Caused by: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@5b3e902b[state=DESTROYED managed connection=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@558c8726 connection handles=0 lastUse=1394423601710 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@44b32228 mcp=SemaphoreArrayListManagedConnectionPool@6f1ca09a[pool=slave-1] xaResource=XAResourceWrapperImpl@4c879354[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@558c8726 pad=false overrideRmValue=null productName=MySQL productVersion=5.5.31-30.3-log jndiName=java:jboss/datasources/slave-1] txSync=null]

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:773)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:516)

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:142)

          ... 139 more

      Caused by: javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering meta-aware object

          at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:530)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:768)

          ... 141 more

      Caused by: javax.transaction.SystemException: IJ000356: Failed to enlist: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 0:ffff0a19e36f:5d250bcd:531d368f:361 status: ActionStatus.ABORT_ONLY >

          at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener$TransactionSynchronization.checkEnlisted(TxConnectionListener.java:808)

          at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:362)

          at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:523)

          ... 142 more

        1 2 Previous Next