This discussion is archived
0 Replies Latest reply: Feb 2, 2013 6:33 AM by PeterLiu RSS

Error in using XA and Non-XA datasource at same time

PeterLiu Newbie
Currently Being Moderated
I think this case may be a little complicated:
there are two actual databases, for example, A is for service/biz, and B is for data archiving. system run the archiving service once a day, we decided to use JTA to ensure that no records would be lost while any exceptions encountered on each side. we create two XADatasouces for A and B. And there is an existed Non-XADatasource in weblogic that be used by general business. it's Database A actually. make a summary:
Two actually databases :
A , B
Three DataSources in Weblogic :
Non-XA-DS , XA-DS1 - > refer to Database A, the business DB
XA-DS2 - > refer to Database B, the archiving DB

And the archiving code like this:

try{
UserTransaction.begin;
fetch Data from XA-DS1;
record logs to Non-XA-DS;
save Data to XA-DS2;
UserTransaction.end;
}catch(){
UserTransaction.rollback;
}finally{
release resources;
}

look at the bold lines. it work well if remove the "*record logs to Non-XA-DS*". but if enable the logs features it will throw out an exception with message " cannot call commit of connection in a distributed transaction". It's weird, that Non-XA-DS is not a XADatasource and I also disabled the Global Transaction Support of the datasource. As i think . that UserTransaction would not manage a DS indicated not support JTA. is that correct? And how can I resolve this problems

Edited by: 985707 on Feb 2, 2013 6:31 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points