Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot invoke a rollback operation when the AutoCommit mode is set to "true" in tomcat-8.5.14 #195

Open
agnijalam opened this issue Nov 22, 2023 · 4 comments

Comments

@agnijalam
Copy link

agnijalam commented Nov 22, 2023

Hi All,
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.SQLServerDriver

The error trace associated with this issue is as follows:

com.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.
Shiju

@GuyPardon
Copy link
Contributor

Hi,

The 4.0 is pretty old. Any way you can try with the current 6.0?

Guy

@agnijalam
Copy link
Author

agnijalam commented Nov 24, 2023

Thank you for your quick response @GuyPardon

We were using atomikos-integration-extension-3.7.2.jar for EnhancedTomcatAtomikosBeanFactory. It seems like atomikos-integration-extension-3.7.2.jar which is deprecated since Atomikos 4.0.0, is not compatible with Atomikos 6.0.0, and I could not find the latest version or any documentation.
Resource
auth="Container"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
factory="com.atomikos.tomcat.EnhancedTomcatAtomikosBeanFactory"
name="jdbc/TESTDataSource"
type="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean"
url="jdbc:sqlserver://localhost:1433;databaseName=testDB"

Upgraded JARs:

atomikos-integration-extension-3.7.2.jar (issue with compatibility, deprecated since Atomikos 4.0.0)
transactions-jms-6.0.0
transactions-jta-6.0.0
transactions-jdbc-6.0.0
transactions-hibernate3-6.0.0
transactions-api-6.0.0
transactions-6.0.0
atomikos-util-6.0.0

ERROR
"localizedMessage": "com/atomikos/jdbc/AbstractDataSourceBean",
"message": "com/atomikos/jdbc/AbstractDataSourceBean",
"name": "java.lang.NoClassDefFoundError",

I am currently searching for a solution. If you have any insights, please share.
Thanks,
Shiju

@GuyPardon
Copy link
Contributor

Hi,

That tomcat integration jar was not maintained by us so I am not sure. We do have certified integration modules in our commercial distribution for which you can get a free trial. I realise this might not be what you want, just mentioning.

I am not sure if the old jar would work with 5.0 instead.

Guy

@agnijalam
Copy link
Author

@GuyPardon We are interested in exploring the free trial option. Could you please provide us with more information on how to proceed?
Thanks,
Shiju

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants