Hi
I have a multi-threaded Java MQSeries application which runs OK most of the time. For throughput reasons, the application can be configured so that many threads can be run to read messages from a remote Queue Manager. Typically, four threads are configured to run.
There are two problems.Sometimes after the application has been restarted, one or two of the threads will successfully connect to the remote Queue Manager. But the others will fail with either a 2009 or 2058 error i.e.
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
and
MQJE001: An MQException occurred: Completion Code 2, Reason 2058
MQJE036: Queue manager rejected connection attempt
The code has retry logic, so that the connection is retried five minutes later (the code retries five times in total before giving up). Sometimes the code recovers. Sometimes, on the retry, connections that had failed with a 2009, fail with a 2058 on the retry. Sometimes, the retry fails again with a 2058.
The code is quite simple. The queue manager name, host name, channel and port are all configuration parameters.
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.port = port;
MQQueueManager queueMan = new MQQueueManager(queueManage
rName);
The problem sometimes occurs after the application has started ok, and been running for a while. Due to a firewall terminating the connection, a 2009 error is incurred. On trying to reconnect to the remote Queue Manager, a 2058 is incurred.
A possible thought that I have, is that the previous incarnation of the program has left some resources open in MQSeries environment somewhere. When it is restarted (new Java VM started), the MQSeries node rejects it with a 2058 which is misleading. Similarly, when the code is trying to recover from a 2009 error.
A slight complexity to this issue. Is that the application is getting this problem, at a client's site. So it's not easy for me to reproduce personally. The client gets this every couple of days.
Regards
Pat
Start Free Trial