[jboss-user] [JCA/JBoss] - "Can't call rollback when autocommit=true" problem with JBos
advaittrivedi
do-not-reply at jboss.com
Tue Dec 18 01:46:58 EST 2007
Hi All,
I am running JBoss 4.2.1.GA and mysql-connector-java-5.0.3. I am having this ds file:
| <datasources>
| <local-tx-datasource>
| <jndi-name>MyDS</jndi-name>
| <connection-url>jdbc:mysql://localhost:4306/myds?autoReconnect=true</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>***</user-name>
| <password>***</password>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
| <dialect>org.hibernate.dialect.MySQLDialect</dialect>
| </local-tx-datasource>
| </datasources>
|
|
my hibernate.cfg.xml
| <hibernate-configuration>
| <session-factory>
| <property name="connection.datasource">java:MyDS</property>
| <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
| <!--
| <property name="hibernate.current_session_context_class">thread</property>
| -->
| <property name="hibernate.connection.release_mode">after_transaction</property>
| <mapping resource="UserInfo.hbm.xml" />
| </session-factory>
| </hibernate-configuration>
|
this is how i retrieve SessionFactory:
| public static SessionFactory getSessionFactory() {
| Configuration conf = new Configuration().configure();
| return conf.buildSessionFactory();
| }
|
this is how i use hibernate session:
| session =sessionFactory.openSession();
| session.beginTransaction();
| session.save(userInfo);
| session.getTransaction().commit();
|
I get this excpetions when i try to get session factory:
| 2007-12-18 11:29:04,090 WARN [org.jboss.resource.connectionmanager.TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener at 19ae30e[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection at 10b8754 handles=0 lastUse=1197957541349 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool at 567b79 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool at 1c44935 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource at 1e1aab1 txSync=null]
| 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:5041)
| at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:86)
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.tidyup(TxConnectionManager.java:683)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.returnManagedConnection(BaseConnectionManager2.java:353)
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:639)
| 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.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)
| at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
| at com.mphasis.mframeopen.hibernate.HibernateUtil.getSessionFactory(HibernateUtil.java:12)
| at com.mphasis.mframeopen.webmetrics.dao.AddUserInfoDAO.getHibernateSessionFactory(AddUserInfoDAO.java:12)
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113647#4113647
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113647
More information about the jboss-user
mailing list