You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jamie McCrindle <ja...@gmail.com> on 2006/06/01 12:41:27 UTC

Re: You cannot commit with autocommit set! problem with incubator-activemq-4.0

I'm getting the same things with a jtds datasource pointing at SQL
Server, as in:

http://issues.apache.org/activemq/browse/AMQ-711

anyone?

On 5/31/06, Adrian Tarau <ad...@daxtechnologies.com> wrote:
> Anybody?
>
> Adrian Tarau wrote:
> > I got this exception when ActiveMQ is initialized with an Oracle
> > datasource.
> >
> > Caused by: java.io.IOException: You cannot commit with autocommit set!
> >    at
> > org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:42)
> >
> >    at
> > org.apache.activemq.store.jdbc.TransactionContext.close(TransactionContext.java:125)
> >
> >    at
> > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:253)
> >
> >    at
> > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:213)
> >
> >    at
> > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:139)
> >
> >    at
> > org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:930)
> >
> >    at
> > org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:888)
> >
> >    at
> > org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:458)
> >
> >    at
> > org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:143)
> >
> >    at
> > org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:133)
> >
> >    ... 62 more
> > Caused by: java.sql.SQLException: You cannot commit with autocommit set!
> >    at
> > org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:434)
> >
> >    at
> > org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:331)
> >
> >    at
> > org.apache.activemq.store.jdbc.TransactionContext.close(TransactionContext.java:119)
> >
> >    ... 71 more
> >
> > Following the exception path I realized that the problem comes from
> > the commit in TransactionContext.close().
> > As the comment explain nicely there shouldn't be any commit there.
> > Any suggestions?
> >
> >
> >
> > public void close() throws IOException {
> >        if( !inTx ) {
> >            try {
> >                executeBatch();
> >                              /**
> >                 * we are not in a transaction so should not be
> > committing ??
> >                 * This was previously commented out - but had
> >                 * adverse affects on testing - so it's back!
> >                 *
> >                 */
> >                try{
> >                    executeBatch();
> >                } finally {
> >                    if (connection != null) {
> >                        connection.commit();
> >                    }
> >                }
> >                          } catch (SQLException e) {
> >                JDBCPersistenceAdapter.log("Error while closing
> > connection: ", e);
> >                throw IOExceptionSupport.create(e);
> >            } finally {
> >                try {
> >                    if (connection != null) {
> >                        connection.close();
> >                    }
> >                } catch (Throwable e) {
> >                    log.warn("Close failed: "+e.getMessage(), e);
> >                } finally {
> >                    connection=null;
> >                }
> >            }
> >        }
> >    }
> >
>
>