1 Reply Latest reply on Jun 26, 2006 10:46 AM by Francois Eric

    Error: Can't call rollback when autocommit=true

    Rüdiger Schulz Newbie

      Using Jboss 4.0.4 GA:

      I have a Servlet for getting image data out of a mysql database. The data comes out of a EJB 3 entity bean, which I load via the EntityManager. The loading works fine, however, if I have a page with more than one image like this on it, I get the following error on the console. Although the stacktrace continues to my code, the Exception is not thrown (my catch (Throwable e) is never called by this), but printed directly.


      13:05:29,203 WARN [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@12dc6[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@f9a6bd handles=0 lastUse=1150628728562 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@137676c context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@6722a6 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@31f0f4 txSync=null]
      java.sql.SQLException: Can't call rollback when autocommit=true
      at com.mysql.jdbc.Connection.rollback(Connection.java:4729)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:86)
      at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.tidyup(TxConnectionManager.java:667)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.returnManagedConnection(BaseConnectionManager2.java:336)
      at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:623)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:266)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:129)
      at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:74)
      at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:445)
      at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:400)
      at org.hibernate.jdbc.ConnectionManager.afterStatement(ConnectionManager.java:275)
      at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:535)
      at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:265)
      at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:281)
      at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:209)
      at org.hibernate.loader.Loader.doQuery(Loader.java:714)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2821)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:370)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:351)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:122)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:178)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:871)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:801)
      at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:155)


      Does anybody have a clue what that means, or how to avoid this?

      I also tried turning autocommit=false in the datasource (trying various ways), but this errors keeps popping up.