I am trying to connect to the MQ7 Server below is the code :
Hashtable props = new Hashtable();
// Change the host name to your host name. Leave it as it is if
// queue manager is on the same machine
props.put(CMQC.HOST_NAME_PROPERTY, serverConfig.server);
props.put(CMQC.PORT_PROPERTY, serverConfig.port);
props.put(CMQC.CHANNEL_PROPERTY, serverConfig.sChannel);
qMgr = new MQQueueManager(qManager, props);
System.out.println("Queue Manager : "+qMgr+" null");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF
| MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE;
queue = qMgr.accessQueue(queueName, openOptions);
System.out.println("Successfully registered");
//creating msg
message = new MQMessage();
it's getting connected but after sending one message its throwing a error
" MQJE001: Completion Code '1', Reason '2068'.
com.ibm.mq.MQException: MQJE001: Completion Code '1', Reason '2068'.
strngError: No valid counters.
strngError: No valid counters.
at com.ibm.mq.MQManagedObject.inquire(MQManagedObject.java:269)
at com.ibm.mq.MQManagedObject.getInt(MQManagedObject.java:479)
at com.ibm.mq.MQQueue.getCurrentDepth(MQQueue.java:995)
at middlewarex.IBMmq.getQueueCount(IBMmq.java:227)
at middlewarex.ThreadScenario.run(ThreadScenario.java:94)
at java.lang.Thread.run(Thread.java:722)
pointing on the line
" public long getQueueCount() throws Exception{
return queue.getCurrentDepth();
} "
Kindly Help me
Did you look up Reason Code 2068 in the manual? Because if you did, you would have seen that using option MQOO_INQUIRE is invalid.
Secondly, why are you opening the queue for BOTH putting and getting messages? This is a VERY bad practice. You say you are sending (putting) a message to a queue, therefore, you should be opening the queue for output only.
Due to firewall I was facing the exception when sending the message. Please try telnet and check whether the firewall is blocking you from accessing the machine.