Author |
Message
|
spidie |
Posted: Mon May 06, 2002 11:39 pm Post subject: |
|
|
Newbie
Joined: 06 May 2002 Posts: 2
|
Hi Everyone - my first post here!
I'm just starting out using the AMI (C++ interface) on our Solaris machine running MQSeries 5.2. I'm already used the MQI and the C++ Interface on this machine with the same queues and had no problems.
Anyway - I have created a repository file and written a simple test application that puts to a queue and receives the response (the reply queue is set to just echo the request queue for test purposes).
The application runs but hangs in the exception handler when I try to access the AmStatus object. I have enabled tracing and can see in the trace that the following error occurs:
Code: |
!(00001) <<< --- AMT C++ Exception details -------- >>>
!(00001) >>> class :AmSession
!(00001) >>> method:open
!(00001) >>> text :amSesOpen failed
!(00001) >>> CC :2
!(00001) >>> RC :49
!(00001) <<< -------------------------------------- >>>
|
Later on in the trace I can see that the RC2 code has been set to 6000 - but I find no mention of this error code in the mq header files or any of the documentation.
I'm puzzled. I've checked that it is retrieving the QM and queue names correctly and I can see that this is all fine from the trace....so I don't know where to go next!
Any help much appreciated.
Steve |
|
Back to top |
|
 |
spidie |
Posted: Mon May 06, 2002 11:41 pm Post subject: |
|
|
Newbie
Joined: 06 May 2002 Posts: 2
|
ps. Here is the full code from my test app....
Code: |
#include <string>
#include <iostream.h>
#include <amtcpp.hpp>
using namespace std;
int main( int argc, char * argv[] )
{
AmSessionFactory* pSessionFactory = NULL;
AmSession* pSession = NULL;
AmSender* pSender = NULL;
AmReceiver* pReceiver = NULL;
AmMessage* pSendMsg = NULL;
AmMessage* pReceiveMsg = NULL;
AmPolicy* pPolicy = NULL;
pSessionFactory = new AmSessionFactory();
pSession = pSessionFactory->createSession("EMA.SESSION");
pPolicy = pSession->createPolicy("EMA.POLICY");
pSender = pSession->createSender("EMA.REQUEST");
pReceiver = pSession->createReceiver("EMA.REPLY");
pSendMsg = pSession->createMessage("EMA.SEND.MESSAGE");
pReceiveMsg = pSession->createMessage("EMA.RECEIVE.MESSAGE");
try
{
pSession->open(*pPolicy);
pSender->open(*pPolicy);
pReceiver->open(*pPolicy);
AmBytes *dataSent = new AmBytes((const char*)"An AMI Test message");
pSendMsg->writeBytes(*dataSent);
pSender->send(*pSendMsg);
pReceiver->receive(*pReceiveMsg);
AmBytes data = pReceiveMsg->readBytes(pReceiveMsg->getDataLength());
cout << "Text received: " << data.dataPtr();
}
catch(AmException& e)
{
AmObject * source = e.getSource();
if (source != NULL)
{
AmStatus status = source->getLastErrorStatus();
cerr << "Object in error; name = " << source->getName().text() << endl;
cerr << "and reasonCode2 = " << status.getReasonCode2() << endl;
cerr << "Object in error; RC = " << status.getReasonCode() << endl;
}
source->clearErrorCodes();
exit(1);
}
// Cleanup
pSession->deleteMessage(&pReceiveMsg);
pSession->deleteMessage(&pSendMsg);
pSession->deleteReceiver(&pReceiver);
pSession->deleteSender(&pSender);
pSession->deletePolicy(&pPolicy);
pSessionFactory->deleteSession(&pSession);
delete pSessionFactory;
}
|
|
|
Back to top |
|
 |
apowell |
Posted: Tue May 07, 2002 1:36 am Post subject: |
|
|
Newbie
Joined: 01 Oct 2001 Posts: 3
|
Steve
The RC = 49 means AMRC_TRANSPORT_ERR which means that, in this case, the MQCONN has failed for some reason. The RC2 is the return code from MQ but I don't know what the 6000 means as it isn't valid.
Assuming your queue manager is defined then check that the initialization section of your policy and the amthosts.xml are correct.
Good luck |
|
Back to top |
|
 |
Newtier |
Posted: Thu Jun 20, 2002 10:21 am Post subject: same problem as yours |
|
|
Newbie
Joined: 14 Mar 2002 Posts: 3
|
We get the same error you are getting. In this case, it is sporadic. We can use the same code, copy the amt.xml and amthosts file and create the same MQSeries objects (QM and Q) on different machines. On one machine it will work and another it will fail.
It even fails with the IBM supplied sample C programs. We've verified the "quick hit" issues, such as making sure the underlying objects exist and are defined properly.
In fact we were looking here hoping someone else found a more obscure solution.
Any more detailed suggestions would be appreciated. |
|
Back to top |
|
 |
crgharm |
Posted: Wed Jul 10, 2002 7:38 am Post subject: Same problem with Cobol sample AMTVOFSN |
|
|
Novice
Joined: 25 Apr 2002 Posts: 21 Location: St. Louis, Missouri
|
We receive the same error running the IBM supplied sample program AMTVOFSN. Have verified object names and can access objects via MQI.
Currently stumped! |
|
Back to top |
|
 |
|