I am using IBM MQ version 7.5 (trial version)
I have created a two queue managers (QM1 and QM2)
Under the QM1:
port : 1421
Queues: q1(local queue)
channel: ch1 (receiver)
Under the QM2:
port :1422
Queues:q2(transmission queue),q3(remote queue)
channel:ch1 (sender)
I can send the messages through QM2's queue q3 to QM1's queue q1. I can also receive and browse the messages through the q2.
But when I use the java to read the messages from q1 I have an error
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
MQJE001: Completion Code 2, Reason 2009
When I check with the IBM site they said it can cause the due to the below reasons
http://www-01.ibm.com/support/docview.wss?uid=swg21226703
- A firewall has terminated the connection.
- An IOException caused the socket to be closed.
- An explicit action caused the socket to be closed by one end.
- The queue manager is offline.
- The maximum number of channels allowed by the queue manager are already open.
- A configuration problem in the Queue Connection Factory (QCF).
But all of the above are looks good in my system. what I missing , Kindly let me know.
public static void main(String[] args) throws MQException {
MQEnvironment.hostname="localhost";
MQEnvironment.channel="ch1";
MQEnvironment.port=1421;
MQQueueManager qMgr= new MQQueueManager("QM1");
MQQueue outputQueue =qMgr.accessQueue("q1", MQC.MQOO_INQUIRE | MQC.MQOO_BROWSE | MQC.MQOO_INPUT_AS_Q_DEF);
//Checking for messages in queue
int i=outputQueue.getCurrentDepth();
System.out.println("Number of messages in queue: "+i);
outputQueue.close();
qMgr.close();
qMgr.disconnect();
}
Adding:
version of the jar :
C:\Program Files (x86)\IBM\WebSphere MQ\java\lib>java -cp ./com.ibm.mq.jar com.ibm.mq.MQJavaLevel
Name: WebSphere MQ classes for Java
Version: 7.5.0.2
Level: p750-002-130627
Build Type: Production
After changing the channel I have received the below error
----- amqrmrsa.c : 898 --------------------------------------------------------
10/20/2017 02:17:37 - Process(16340.40) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(user1) Installation(Installation1)
VRMF(7.5.0.2) QMgr(Receiver)
AMQ9777: Channel was blocked
EXPLANATION:
The inbound channel 'SYSTEM.DEF.SVRCONN' was blocked from address '127.0.0.1'
because the active values of the channel matched a record configured with
USERSRC(NOACCESS). The active values of the channel were 'CLNTUSER(fresher)'.
ACTION:
Contact the systems administrator, who should examine the channel
authentication records to ensure that the correct settings have been
configured. The ALTER QMGR CHLAUTH switch is used to control whether channel
authentication records are used. The command DISPLAY CHLAUTH can be used to
query the channel authentication records.
----- cmqxrmsa.c : 926 --------------------------------------------------------
10/20/2017 02:17:37 - Process(16340.40) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(user1) Installation(Installation1)
VRMF(7.5.0.2) QMgr(Receiver)
AMQ9999: Channel 'SYSTEM.DEF.SVRCONN' to host 'user1 (127.0.0.1)' ended
abnormally.
EXPLANATION:
The channel program running under process ID 16340(5348) for channel
'SYSTEM.DEF.SVRCONN' ended abnormally. The host name is 'user1
(127.0.0.1)'; in some cases the host name cannot be determined and so is shown
as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide.
----- amqrmrsa.c : 898 --------------------------------------------------------