We are currently managing a Spring Hibernate web application operating on Tomcat 8.x, with Atomikos 4.0.4 serving as the transaction manager. The backend database is SQL Server.

We have encountered an issue during write operations under high loads, where the system occasionally throws an error stating, "Cannot invoke a rollback operation when the AutoCommit mode is set to 'true'." This occurrence is primarily observed when executing transactions with elevated workloads.

To provide additional context, our application utilizes a JNDI connection configured as follows:

<Resource name="JDBC/test" auth="Container" type="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean" factory="com.atomikos.tomcat.EnhancedTomcatAtomikosBeanFactory" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDrive/>

The error trace associated with this issue is as follows:

om.microsoft.sqlserver.jdbc.SQLServerException: Cannot invoke a rollback operation when the AutoCommit mode is set to "true".
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(SQLServerConnection.java:3198)
at com.atomikos.jdbc.nonxa.AtomikosThreadLocalConnection.transactionTerminated(AtomikosThreadLocalConnection.java:382)
at com.atomikos.jdbc.nonxa.AtomikosNonXAParticipant.rollback(AtomikosNonXAParticipant.java:146)
at com.atomikos.icatch.imp.TxRollbackOnlyStateHandler.addParticipant(TxRollbackOnlyStateHandler.java:39)
at com.atomikos.icatch.imp.CompositeTransactionImp.addParticipant(CompositeTransactionImp.java:162)
at com.atomikos.jdbc.nonxa.AtomikosThreadLocalConnection.updateInTransaction(AtomikosThreadLocalConnection.java:196)
at com.atomikos.jdbc.nonxa.AtomikosThreadLocalConnection.invoke(AtomikosThreadLocalConnection.java:276)
at com.sun.proxy.$Proxy120.prepareStatement(Unknown Source)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1940)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1909)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)
at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:525)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:416)
at org.hibernate.engine.query.spi.HQLQueryPlan.performIterate(HQLQueryPlan.java:317)
at org.hibernate.internal.SessionImpl.iterate(SessionImpl.java:1553)
at org.hibernate.query.internal.AbstractProducedQuery.doIterate(AbstractProducedQuery.java:1352)
at org.hibernate.query.internal.AbstractProducedQuery.iterate(AbstractProducedQuery.java:1340)

Any assistance or guidance you could provide on resolving this issue would be greatly appreciated.

Thank you for your time and consideration.

0

There are 0 best solutions below