Getting "You cannot commit with autocommit set!" error

Solution Unverified - Updated -

Issue

  • We are in the process of the enabling the Connection pool for our applications using JBoss Datasource.
    Our application uses the following technologies:
    1. JBoss Application Server 5.0 EAP

    2. Business layer is developed using Hibernate technology under Spring Framework.

    3. Oracle 11g is the back-end database.

    4. SSL is enabled between Hibernate and Oracle 11g.

After completing the configurations required for enabling the JBoss Connection pool, our application is getting the SSL enabled database connections, and the database read operations are going fine, but when we try to commit any database transactions we are getting the below error message. Without the JBoss Connection pool enabled, our application works without any issues.

The error message from the JBoss server.log file:

ERROR [package.name.LogObject] (http-0.0.0.0-8443-1) Exception occured while creating intake
java.sql.SQLException: You cannot commit with autocommit set!
        at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:661)
        at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:486)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        .

Data source type is no-tx-datasource and connection.autocommit property is set to false.
The data source configuration looks like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>;
<datasources>  
    <!--<local-tx-datasource>-->  
    <no-tx-datasource>
        <jndi-name>dataDS</jndi-name>  
        <rar-name>jboss-local-jdbc.rar</rar-name>  
        <use-java-context>false</use-java-context>  
        <connection-definition>javax.sql.DataSource</connection-definition>  
        <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>  
        <min-pool-size>4</min-pool-size>  
        <max-pool-size>8</max-pool-size>  
        <connection-property name="autoCommit">false</connection-property>
        .
        .

The hibernate configuration looks like:

<?xml version='1.0' encoding='UTF-8'?>  
<!DOCTYPE hibernate-configuration PUBLIC  "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->  
<hibernate-configuration>
        <session-factory>
                <!--Database Connection Pool changes starts here -->  
                <property name="connection.datasource">dataDS</property>  
                <!--<property name="connection.release_mode">auto</property>-->  
                <property name="connection.release_mode">auto</property>  
                <property name="connection.autocommit">false</property>
                .
                .

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content