com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Can't call rollback when autocommit=true

夙愿已清 提交于 2020-01-14 03:03:33

问题


Im using Jboss5.0 with mysql in my application. and there will be lot of concurrent actions and DB contains considerably lot of records. this error is coming frequently.. every now and then.

 com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:
 Can't call rollback when
 autocommit=true    at
 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
    at
 com.mysql.jdbc.Connection.rollback(Connection.java:5192)
    at
 org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:97)
    at
 org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.tidyup(TxConnectionManager.java:783)
    at
 org.jboss.resource.connectionmanager.BaseConnectionManager2.returnManagedConnection(BaseConnectionManager2.java:453)
    at
 org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:734)
    at
 org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:362)
    at
 org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:155)

can anyone help?

Thanks in advance


回答1:


Either you are attempting to call rollback when auto commit is turned on, or you're using MyISAM type tables in your database which do not support transactions (and the ability to rollback).

Judging by the stacktrace, a transaction to the database is failing and in an attempt to create an SQLException and rollback the transaction, this exception is occurring. Unless there's more to the exception (like an indication as to where in your code the exception is being fired), then I would hazard a guess that it's due to MyISAM tables.



来源:https://stackoverflow.com/questions/3911968/com-mysql-jdbc-exceptions-mysqlnontransientconnectionexception-cant-call-rollb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!