Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

PersistenceException: Cannot set auto-commit mode when using distributed transactions

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm trying to run a simple example from Chapter 2 where the PlaceBidBean tries to persist a Bid object to the DB Table (BIDS),
however upon running the PlaceBidBeanClient to test the Session bean through ANT i get the following error:

run:
[echo] Executing client class
[java] javax.ejb.EJBException: nested exception is: <1.0.0.1.1 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Cannot set auto-commit mode when using distributed transactions
[java] <1.0.0.1.1 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Cannot set auto-commit mode when using distributed transactions
[java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:546)

[java] at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1040)
[java] at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
[java] at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
[java] Caused by: java.lang.Exception: java.sql.SQLException: Cannot set auto-commit mode when using distributed transactions



And I cannot find a way that i can manually configure the JDBC Connection Pool to disable autocommit.

Can anyone please advice - i have searched the Net but there is no solution that i have successfully found.




 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check your datasource properties in your xml file or thru application server console.
 
Siphiwe Madi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have checked my datasource, everything looks fine. Is there a place withing DB or App Server where I can turn auto-commit off?

Please assist - I have been stuck on trying to run chapter 2 using Oracle db ever since and time is running out on me

Help
 
Praful Thakare
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have checked my datasource, everything looks fine. Is there a place withing DB or App Server where I can turn auto-commit off?



what looks fine? where did you check your datasource in datasource xml file or persistence.xml ?

yes you can change setting in App Server, for websphere there is no default property ,so you will have to add customer property and set the value not sure about weblogic.

-Praful
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic