Author |
Message
|
elenzo |
Posted: Tue Jun 28, 2011 6:52 am Post subject: MQ Reason code 3013 when using PCF INQUIRE_Q_STATUS |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
Hi, i am writting some java code to administer MQ from a website. I could list name queues, curdepth, input count and some other parameters using PCF, but i am having the hardest time listing the queue status. What I need is what this mq command shows, but using java instead of mqsc command.
DIS QS(EE.INPUTQ) TYPE(HANDLE) PID ALL
14 : DIS QS(EE.INPUTQ) TYPE(HANDLE) PID ALL
AMQ8450: Ver detalles del estado de la cola.
QUEUE(EE.INPUTQ) TYPE(HANDLE)
APPLDESC(WebSphere MQ Channel)
APPLTAG(WebSphere MQ Client for Java)
APPLTYPE(SYSTEM) BROWSE(NO)
CHANNEL(SYSTEM.DEF.SVRCONN) CONNAME(127.0.0.1)
ASTATE(NONE) HSTATE(INACTIVE)
INPUT(NO) INQUIRE(YES)
OUTPUT(YES) PID(3532)
QMURID(0.0) SET(NO)
TID(10)
URID(XA_FORMATID[00000000] XA_GTRID[] XA_BQUAL[])
URTYPE(QMGR)
I found in the forum this post ( http://www.mqseries.net/phpBB2/viewtopic.php?p=103568&sid=1aa7b94f4e6aeac240b2bf646958c374)that have the exact code I need, but i am getting mq reason code 3013 when I run it.
I am in a Windows environment with MQ 7.0.1.4.
It would be great if someone could help me solving this problem!
PS: Sorry for my english, is obvious that is not my native language..... |
|
Back to top |
|
 |
elenzo |
Posted: Tue Jun 28, 2011 6:57 am Post subject: CODE |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
The code I am running is:
public static void main(String[] args) {
// TODO Auto-generated method stub
PCFMessageAgent agent = null;
try {
// Create INQUIRE_Q_STATUS PCF message
PCFMessage inquireQueueStatus = new PCFMessage(
CMQCFC.MQCMD_INQUIRE_Q_STATUS);
// Fixed & working code
inquireQueueStatus.addParameter(CMQC.MQCA_Q_NAME, "EE.INPUTQ");
inquireQueueStatus.addParameter(CMQCFC.MQIACF_Q_STATUS_TYPE,
CMQCFC.MQIACF_Q_HANDLE);
inquireQueueStatus.addParameter(CMQCFC.MQIACF_Q_ATTRS,
new int[] { CMQCFC.MQIACF_ALL });
// Connect to qmgr
agent = new PCFMessageAgent();
agent.connect("localhost",1414,"SYSTEM.DEF.SVRCONN");
// Send the INQUIRE_Q_STATUS PCF request
PCFMessage response[] = agent.send(inquireQueueStatus);
// Print the INQUIRE_Q_STATUS PCF response(s)
for (int i = 0; i < response.length; i++) {
String queueName = (String) response[i]
.getParameterValue(CMQC.MQCA_Q_NAME);
String channelName = (String) response[i]
.getParameterValue(CMQCFC.MQCACH_CHANNEL_NAME);
String connectionName = (String) response[i]
.getParameterValue(CMQCFC.MQCACH_CONNECTION_NAME);
System.out.println(queueName + ", " + channelName + ", "
+ connectionName);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (agent != null) {
try {
agent.disconnect();
} catch (MQException ignored) {
}
}
}
}
And i am getting the error (3013) when it executes the following line:
PCFMessage response[] = agent.send(inquireQueueStatus); |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 28, 2011 6:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
are you importing the correct packages?
you should look very carefully at your java import statements to make sure they are pointing at the correct packages. |
|
Back to top |
|
 |
elenzo |
Posted: Tue Jun 28, 2011 7:01 am Post subject: |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
Hi mqjeff, I am using the same package i use in other classes that works fins. The import looks like this:
import com.ibm.mq.MQException;
import com.ibm.mq.pcf.* |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 28, 2011 7:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So if I look at the PCF samples that come with my MQ, I see things like "MQConstants.MQCMD_INQUIRE_QUEUE_STATUS" rather than "CMQCFC.MQCMD_INQUIRE_Q_STATUS".
And MQRC 3013 indicates that you've set the wrong "type" for a PCF parameter, so I'd try to switch all of your CMQC, CMQCFC, etc. to MQConstants package instead. |
|
Back to top |
|
 |
elenzo |
Posted: Tue Jun 28, 2011 7:41 am Post subject: |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
mqjeff, i cant find those samples using MQConstants, could you add the link or the code ? Thanks a lot! |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 28, 2011 8:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I mean the samples that get installed when you install MQ.
but again, just go through and replace every single use you have of CMQC or CMQCF or etc. as a standalone package CMQC.<anything> with MQConstants.<anything> |
|
Back to top |
|
 |
elenzo |
Posted: Tue Jun 28, 2011 9:22 am Post subject: |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
Well... i changed the code and replace every "CMQC" and "CMQCFC" for MQConstants (had to import com.ibm.mq.jmqi.jar) and it is still failing, but with a different reason code.
MQJE001: Código de terminación 2, razon "4091"
The code 4091 means that it cant connect to a remote qmgr.... any ideas ?? Im gonna google that code a bit more. |
|
Back to top |
|
 |
elenzo |
Posted: Tue Jun 28, 2011 9:32 am Post subject: |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
Correction... the reason code 4091 was because there were no status to display (nobody connect to the queue). I connected a process and now i am getting reason code 3013 again. |
|
Back to top |
|
 |
elenzo |
Posted: Wed Jun 29, 2011 6:27 am Post subject: Solution |
|
|
Acolyte
Joined: 22 Aug 2006 Posts: 53
|
Problem solve..... I was using an old version of com.ibm.mq.pcf library. I replaced it with the one of MQ v7 and now it works fine. |
|
Back to top |
|
 |
|