|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Two-Phase Commit Coordinated by Queue Manager - MQJE001 |
« View previous topic :: View next topic » |
Author |
Message
|
saadz |
Posted: Mon Apr 10, 2006 9:11 am Post subject: Two-Phase Commit Coordinated by Queue Manager - MQJE001 |
|
|
Newbie
Joined: 10 Apr 2006 Posts: 5
|
Hi Guys,
I am using following environment...
OS = Windows 2000 Professional
MQ = WebSphere MQ ver 5.3
DB = DB2 ver 8.2
I am trying to run following program (provided by IBM)...
/**************************************************************************/
System.out.println("mqdb2log started...");
Hashtable mqProperties = new Hashtable();
mqProperties.put(MQC.THREAD_AFFINITY, new Boolean(true));
qMgr = new MQQueueManager(qmgrName, mqProperties);
int openOptions = MQC.MQOO_OUTPUT;
MQQueue myQueue = qMgr.accessQueue(queueName, openOptions, null, null, null);
COM.ibm.db2.jdbc.DB2XADataSource myDataSource =
new COM.ibm.db2.jdbc.DB2XADataSource();
myDataSource.setDatabaseName(dbName);
myDataSource.setUser("abc");
myDataSource.setPassword("abc");
jdbcConn = qMgr.getJDBCConnection(myDataSource);
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br= new BufferedReader(isr);
String runShow;
System.out.println("mqdb2log ready for db command");
do {
runShow = br.readLine();
if (runShow.length() > 0) {
qMgr.begin();
MQMessage myMessage = new MQMessage();
myMessage.writeString(runShow);
myMessage.format = MQC.MQFMT_STRING;
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = pmo.options | MQC.MQPMO_SYNCPOINT;
myQueue.put(myMessage, pmo);
boolean validStatement = true;
Statement stmt = jdbcConn.createStatement();
try {
int rowsUpdated = stmt.executeUpdate(runShow);
System.out.println("Rows updated: " + rowsUpdated);
} catch (java.lang.Exception ex) {
validStatement = false;
System.out.println("Java exception: " + ex);
System.out.println(" mqdb2log is designed to work only with update statements.\n");
}
stmt.close();
if (validStatement) {
System.out.println("Enter C to Commit or R to rollback");
runShow = br.readLine();
if ((runShow.indexOf("c") >= 0) || (runShow.indexOf("C") >= 0)) {
qMgr.commit();
} else {
qMgr.backout();
}
} else {
qMgr.backout();
}
}
System.out.println("mqdb2log ready for db command");
} while (runShow.length() > 0) ;
myQueue.close();
jdbcConn.close();
qMgr.disconnect();
/**************************************************************************/
Now, I am getting this error -> MQJE001: Completion Code 1 Reason Code 2121
Here is my XA Resource Manager Settings
Name=MYDB2DB
SwitchFile=C:\Program Files\IBM\WebSphere MQ\Java\lib\jdbc\jdbcdb2.dll
XAOpenString=DB2DB
I already copy the jvm.dll in my path, so Queue Manager starts Ok... it is giving me error on this line -> qMgr.begin();
Following is the trace log... any help will be great... Thanks in advance...
03:14:14 [1144350854132] Thread: MQBindingsQMThread0 <== com.ibm.mq.server_MQSESSION::_MQOPEN() exit
03:14:14 [1144350854132] Thread: MQBindingsQMThread0 ==> NativeMQOD::~NativeMQOD() entry
03:14:14 [1144350854132] Thread: MQBindingsQMThread0 <== NativeMQOD::~NativeMQOD() exit
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.MQOD@7bd9f2 ==> updateDistributionListItems() entry
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.MQOD@7bd9f2 <== updateDistributionListItems() exit
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 MQOPEN returning hObj 23322096
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 CC,RC = 0,0
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 <== MQOPEN() exit
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc Opened queue name = TEST
03:14:14 [1144350854132] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc <== accessQueue() exit
03:14:14 [1144350854243] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc ==> getJDBCConnection() entry
03:14:14 [1144350854243] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc ==> getJDBCConnection(u,p)() entry
03:14:14 [1144350854273] Thread: main ==> XAtoJTA::helpGetConnection() entry
03:14:16 [1144350856476] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 ==> XAREGISTER() entry
03:14:16 [1144350856486] Thread: main ==> MQSESSION::getLibraryPath() entry
03:14:16 [1144350856486] Thread: main Class: MQSESSION path ''
03:14:16 [1144350856486] Thread: main <== MQSESSION::getLibraryPath() exit
03:14:16 [1144350856486] Thread: main ==> MQSESSION::loadLib() entry
03:14:16 [1144350856486] Thread: main Class: MQSESSION Load this library: 'MQXAi02'
03:14:16 [1144350856496] Thread: main <== MQSESSION::loadLib() exit
03:14:16 [1144350856496] Thread: MQBindingsQMThread0 ==> XAtoJTA::registerResource() entry
03:14:16 [1144350856496] Thread: MQBindingsQMThread0 ==> XAtoJTA::getInstance() entry
03:14:16 [1144350856496] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 ==> constructor() entry
03:14:16 [1144350856496] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 common/javabase/com/ibm/mq/XAtoJTA.java, java, j530, j530-L021003 02/10/02 12:36:01 @(#) 1.9.2.2
03:14:16 [1144350856496] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 <== constructor() exit
03:14:16 [1144350856496] Thread: MQBindingsQMThread0 <== XAtoJTA::getInstance() exit
03:14:16 [1144350856506] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 ==> _registerResource() entry
03:14:16 [1144350856506] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 not in transaction, adding to spare conns
03:14:16 [1144350856506] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 <== _registerResource() exit
03:14:16 [1144350856506] Thread: MQBindingsQMThread0 <== XAtoJTA::registerResource() exit
03:14:16 [1144350856506] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 <== XAREGISTER() exit
03:14:16 [1144350856506] Thread: main <== XAtoJTA::helpGetConnection() exit
03:14:16 [1144350856506] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc <== getJDBCConnection(u,p)() exit
03:14:16 [1144350856506] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc <== getJDBCConnection() exit
03:14:48 [1144350888602] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc ==> begin() entry
03:14:48 [1144350888602] Thread: main, Object com.ibm.mq.server.MQSESSION@30e280 ==> MQBEGIN() entry
03:14:48 [1144350888602] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 Conn Handle = 182843072
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 ==> XAtoJTA::resetRC() entry
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 ==> XAtoJTA::getInstance() entry
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 <== XAtoJTA::getInstance() exit
03:14:48 [1144350888602] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 resetting beginRC
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 <== XAtoJTA::resetRC() exit
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 ==> NativePint::NativePint() entry
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 <== NativePint::NativePint() exit
03:14:48 [1144350888602] Thread: MQBindingsQMThread0 ==> com.ibm.mq.server_MQSESSION::_MQBEGIN() entry
03:14:48 [1144350888612] Thread: MQBindingsQMThread0 ==> XAtoJTA::XAOpen() entry
03:14:48 [1144350888612] Thread: MQBindingsQMThread0 Class: XAtoJTA open string 'DB2DB', rmid 1
03:14:48 [1144350888612] Thread: MQBindingsQMThread0 ==> XAtoJTA::getInstance() entry
03:14:48 [1144350888612] Thread: MQBindingsQMThread0 <== XAtoJTA::getInstance() exit
03:14:48 [1144350888612] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 ==> xa_open() entry
03:14:48 [1144350888612] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 open count is now 1
03:14:48 [1144350888612] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 <== xa_open() exit
03:14:48 [1144350888612] Thread: MQBindingsQMThread0 <== XAtoJTA::XAOpen() exit
03:14:48 [1144350888642] Thread: MQBindingsQMThread0 Class: _MQBEGIN CompCode: 1
03:14:48 [1144350888642] Thread: MQBindingsQMThread0 Class: _MQBEGIN Reason: 2122
03:14:48 [1144350888642] Thread: MQBindingsQMThread0 <== com.ibm.mq.server_MQSESSION::_MQBEGIN() exit
03:14:48 [1144350888642] Thread: MQBindingsQMThread0 ==> XAtoJTA::getRC() entry
03:14:48 [1144350888642] Thread: MQBindingsQMThread0 ==> XAtoJTA::getInstance() entry
03:14:48 [1144350888642] Thread: MQBindingsQMThread0 <== XAtoJTA::getInstance() exit
03:14:48 [1144350888642] Thread: MQBindingsQMThread0, Object: com.ibm.mq.XAtoJTA@1dfafd1 returning beginRC=2121
03:14:48 [1144350888652] Thread: MQBindingsQMThread0 <== XAtoJTA::getRC() exit
03:14:48 [1144350888652] Thread: MQBindingsQMThread0 Class: MQSESSION overriding reason code from 2122 to 2121
03:14:48 [1144350888652] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 CC,RC = 1,2121
03:14:48 [1144350888652] Thread: main, Object: com.ibm.mq.server.MQSESSION@30e280 <== MQBEGIN() exit
03:14:48 [1144350888752] Thread: main, Object: com.ibm.mq.MQException: MQJE001: Completion Code 1, Reason 2121 ==> MQException constructor(cc, rc, source)() entry
03:14:48 [1144350888762] Thread: main, Object: com.ibm.mq.MQException: MQJE001: Completion Code 1, Reason 2121 common/javabase/com/ibm/mq/MQException.java, java, j530, j530-L020820 02/08/09 13:29:42 @(#) 1.39
03:14:48 [1144350888762] Thread: main, Object: com.ibm.mq.MQException: MQJE001: Completion Code 1, Reason 2121 cc = 1
03:14:48 [1144350888762] Thread: main, Object: com.ibm.mq.MQException: MQJE001: Completion Code 1, Reason 2121 rc = 2121
03:14:48 [1144350888762] Thread: main, Object: com.ibm.mq.MQException: MQJE001: Completion Code 1, Reason 2121 source = com.ibm.mq.MQQueueManager@b66cc
03:14:48 [1144350888762] Thread: main, Object: com.ibm.mq.MQException: MQJE001: Completion Code 1, Reason 2121 <== MQException constructor() exit
03:14:48 [1144350888762] Thread: main, Object: com.ibm.mq.MQQueueManager@b66cc <== begin (via exception)() exit |
|
Back to top |
|
 |
wschutz |
Posted: Mon Apr 10, 2006 10:28 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
does AMQERR01.LOG show anything? IIRC, it should have some indication that it was able to connect to db2 as a resource manager. _________________ -wayne |
|
Back to top |
|
 |
saadz |
Posted: Mon Apr 10, 2006 11:55 am Post subject: AMQERR01.log |
|
|
Newbie
Joined: 10 Apr 2006 Posts: 5
|
AMQ7604: The XA resource manager 'MYDB2DB' was not available when called for xa_open. The queue manager is continuing without this resource manager.
EXPLANATION:
The XA resource manager 'MYDB2DB' has indicated that it is not available, by returning XAER_RMERR on an xa_open request or XAER_RMFAIL when called for something else. Normally this indicates that the resource manager has been shutdown. In this case the resource manager cannot participate in any new transactions. Any in-flight transactions in which it was involved will be backed out, and any transactions in which it is in-doubt will only be resolved when contact with the resource manager is re-established. A further message will be issued when the queue manager has been able to do this. If the problem occurred on an xa_open request, and the resource manager should be available, then there may be a configuration problem.
ACTION:
Try to establish the reason why the resource manager is unavailable. It may be that an invalid XAOpenString has been defined for the resource manager in the 'qm.ini' configuration file. If this is the case, stop and then restart the queue manager so that any change will be picked up. Alternatively, the queue manager may be reaching a resource constraint with this resource manager. For example, the resource manager may not be able to accommodate all of the queue manager processes being connected at one time, you may need to alter one of its tuning parameters. |
|
Back to top |
|
 |
mvic |
Posted: Mon Apr 10, 2006 11:59 am Post subject: Re: AMQERR01.log |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
saadz wrote: |
ACTION:
Try to establish the reason why the resource manager is unavailable. It may be that an invalid XAOpenString has been defined for the resource manager in the 'qm.ini' configuration file. If this is the case, stop and then restart the queue manager so that any change will be picked up. Alternatively, the queue manager may be reaching a resource constraint with this resource manager. For example, the resource manager may not be able to accommodate all of the queue manager processes being connected at one time, you may need to alter one of its tuning parameters. |
OK so DB2 failed the xa_open call. The most likely cause is a configuration error in the xa_open string (incorrect username/password perhaps?). It would be helpful to check through DB2 logs to find the reason why it failed, if it isn't obvious from a review of the xa_open string. |
|
Back to top |
|
 |
wschutz |
Posted: Mon Apr 10, 2006 12:04 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
|
Back to top |
|
 |
mvic |
Posted: Mon Apr 10, 2006 12:21 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
"XAOpenString=DB2DB" used to be a correct xa_open string in prior versions of DB2. It may still work, but since this is DB2 v8 or higher, you need to add a toc=X to the xa_open string in order to match the DB2 and MQ threadofcontrol settings.
Valid combinations are :
toc=p and ThreadOfControl=PROCESS
toc=t and ThreadOfControl=THREAD
NB. documentation for correct DB2 xa_open strings is in the DB2 manuals - it used to be in one of the (3?) volumes of the Administration Guide - don't know exactly where it is today - do DB2 have an Info Center? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|