Atomikos Forum

Cannot call method 'commit' while a global transaction is runnin

I’m trying run Atomikos TransactionsEssentials with JPA(Hibernate). I’m getting this exception “Cannot call method 'commit' while a global transaction is running”. This is occuring when the EntityManager executes a persist:


UserTransaction userTransaction = new com.atomikos.icatch.jta.UserTransactionImp();
 HibernateEntityManagerFactory emf =  (HibernateEntityManagerFactory) Persistence.createEntityManagerFactory("wlsm");
 userTransaction.begin();
  EntityManager em = emf.createEntityManager();
 EventEntity event = new EventEntity();
 event.setFromClassId(ClassConstants.TOUR_CLASS_ID);
 event.setFromId(12212);
 event.setStatusCid(1331);
  em.persist(event);// throws exception
 userTransaction.commit();

My persistence.xml
<property name="hibernate.connection.provider_class" value="com.atomikos.icatch.jta.hibernate3.AtomikosConnectionProvider"/>
<property name="hibernate.connection.atomikos.nonxa" value="true"/>
<property name="hibernate.connection.atomikos.driverClassName" value="com.informix.jdbc.IfxDriver"/>
<property name="hibernate.connection.atomikos.poolSize" value="1"/>
<property name="hibernate.connection.atomikos.maxPoolSize" value="1"/>
<property name="hibernate.connection.atomikos.user" value="informix"/>
<property name="hibernate.connection.atomikos.password" value="Werner1#"/>
<property name="hibernate.connection.atomikos.url" value="jdbc:informix-sqli://localhost:5621/wlms:INFORMIXSERVER=IDSLOCAL"/>
<property name="hibernate.connection.atomikos.uniqueResourceName" value="wlms"/>

my jta.properties
com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory
com.atomikos.icatch.console_log_level=TRACE
com.atomikos.icatch.output_dir=D:\log
com.atomikos.icatch.console_file_name=tms.log
com.atomikos.icatch.log_base_name=tmlog
com.atomikos.icatch.automatic_resource_registration=false
com.atomikos.icatch.force_shutdown_on_vm_exit=true

I seen one post one this, but there was no solution offered.
Jay Watts Send private email
Thursday, June 09, 2011
 
 
Guy Pardon Send private email
Thursday, June 09, 2011
 
 
Yes I did.
Jay Watts Send private email
Thursday, June 09, 2011
 
 
I download the source code and step through in debug mode(Eclipse). Exception is thrown in AtomikosThreadLocalConnection.invoke

else if ( isInTransaction() ) {
            if (XA_INCOMPATIBLE_METHODS.contains(methodName))
                AtomikosSQLException.throwAtomikosSQLException("Cannot call method '" + methodName + "' while a global transaction is running");
Jay Watts Send private email
Thursday, June 09, 2011
 
 
I got this working, problem was with my persistence.xml configuration...was using hibernate 2 property names instead of hibernate 3 property names.
Jay Watts Send private email
Friday, June 10, 2011
 
 
Cool - thanks for the update!
Guy Pardon Send private email
Tuesday, June 14, 2011
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics