Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Transaction Management: BMP & CMP

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

As part of my application implementation I am doing following

1. MDB gets triggered when system finds message in Q
2. MDB calls Stateless Session Bean
3. Stateless Session Beans performs operations on CMP Entiry Beans as well as BMP entity beans in following sequence
UserTransaction tx = getSessionContext().getUserTransaction();
tx.start();
try{
Perform operation with CMP Entity Bean 1
Perform operation with another Stateless Session Bean
Perform operation with CMP Entity Bean 2
Perform operation with CMP Entity Bean 3
Perform operation with BMP Entity Bean 4
}
finally{
try {
if (tx.getStatus() !=
javax.transaction.Status.STATUS_MARKED_ROLLBACK){
tx.rollback();
}
else {
tx.commit();
}
}

If there a problem in BMP, I want all operations to roll back.


Am I doing anything wrong? Because I am getting problem in my BMP (last step) saying that
"illegal attempt to use multiple resources that have only one-phase capability".

Any suggestions ??
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to check the database driver classes configured for your datasource. They should be XA Drivers. For example, for Oracle database one should use oracle.jdbc.xa.client.OracleXADataSource.
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic