Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

An illegal attempt to commit a one phase capable resource with existing two phase ca

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one explain what wil happen if i use both Xa connection and a normal connetion in a single EJB transaction.

Cause in the application i am getting the following error and i doubt its because both Xa connection and a normal connetion has been used in a single EJB transaction
 
author & internet detective
Posts: 39790
797
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bala,
Welcome to JavaRanch!

If there is a transaction rollback, it will likely not work properly. While you can sometimes rollback one non-XA event in a transaction, it doesn't always work properly.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need XA? As the XA protocol is a significant overhead compared to local transactions, you should consider carefully if distributed transactions are really needed.
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bala,

J2EE 1.4 onwards JTA was implicitly supported by all compliant app servers. If you have only one resource either nonXA or XA participating in a transaction then it automatically starts a one phase commit(local transaction). It more than one nonXA resource participates in a local transaction... then the transaction is rolled back. If more than one XA resources participate in transaction then the transaction becomes a global transaction(2 phase commit).

Ideally for a 2 phase commit(global transaction) all resources must be XA or else the transaction is rolled back. However most of the servers support something called as "last agent optimization" which allows one and only one nonXA resource to participate in a global transaction (2 phase commit). So if you have set this flag to true on your appserver's transaction service then you should not get any rollbacks due to XA and nonXA resource participating in a global transaction
 
Happily living in the valley of the dried frogs with a few tiny ads.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!