Using IBM MQ 8.0.0.9
I cannot duplicate the behavior of the MQExplorer
GUI actions from the command line.
Using MQExplorer
I create:
- A Queue Manager titled
testQueueManager
using defaults - A Queue titled
testQueue
using defaults - A Server-connection channel titled
testChannel
using defaults - A Channel Authentication Record using an Address Map of
*
-> User idclient
Java clients connect to that instance without issue.
The following shell script should duplicate the above from what I can tell. I'm aware I'm granting more permissions than necessary, this is purely for connection testing.
#!/bin/sh
set -eu
user=client
pass=password
qmgr="testQueueManager"
channel="testChannel"
queue="testQueue"
useradd "$user" && echo "$user":password | chpasswd
/opt/mqm/bin/crtmqm "$qmgr"
/opt/mqm/bin/strmqm "$qmgr"
/opt/mqm/bin/runmqsc "$qmgr" << EOF
DEFINE QLOCAL('$queue')
DEFINE CHANNEL('$channel') CHLTYPE(SVRCONN) TRPTYPE(TCP)
SET CHLAUTH('$channel') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(MAP) MCAUSER('$user') ACTION(ADD)
EOF
/opt/mqm/bin/setmqaut -m "$qmgr" -t qmgr -p client +all
/opt/mqm/bin/setmqaut -m "$qmgr" -n "$channel" -t channel -p client +all
/opt/mqm/bin/setmqaut -m "$qmgr" -n "$queue" -t queue -p client +all
Here's the output of the shell script when I run it:
WebSphere MQ queue manager created.
Directory '/var/mqm/qmgrs/testQueueManager' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'testQueueManager'.
Default objects statistics : 79 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
WebSphere MQ queue manager 'testQueueManager' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'testQueueManager' during the log replay phase.
Log replay for queue manager 'testQueueManager' complete.
Transaction manager state recovered for queue manager 'testQueueManager'.
WebSphere MQ queue manager 'testQueueManager' started using V8.0.0.9.
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager testQueueManager.
1 : DEFINE QLOCAL('testQueue')
AMQ8006: WebSphere MQ queue created.
2 : DEFINE CHANNEL('testChannel') CHLTYPE(SVRCONN) TRPTYPE(TCP)
AMQ8014: WebSphere MQ channel created.
3 : SET CHLAUTH('testChannel') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(MAP) MCAUSER('client') ACTION(ADD)
AMQ8877: WebSphere MQ channel authentication record set.
3 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
The setmqaut command completed successfully.
The setmqaut command completed successfully.
The setmqaut command completed successfully.
I expect the same behavior from the Java client connecting to the same items. What I get is a nasty stack trace as follows:
org.apache.felix.log.LogException: com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'testQueueManager' with connection mode 'Client' and host name '127.0.0.1(1414)'.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:423)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8475)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7814)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:299)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:236)
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6016)
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6041)
... 7 more
Caused by: org.apache.felix.log.LogException: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
... 15 more
Caused by: org.apache.felix.log.LogException: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9204: Connection to host '127.0.0.1(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2009;AMQ9208: Error on receive from host '/127.0.0.1:1414 (localhost)'. [1=-1,2=ffffffff,3=/127.0.0.1:1414 (localhost),4=TCP]],3=127.0.0.1(1414),5=RemoteConnection.receiveTSH]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2276)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1288)
at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:560)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:356)
... 14 more
Caused by: org.apache.felix.log.LogException: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9208: Error on receive from host '/127.0.0.1:1414 (localhost)'. [1=-1,2=ffffffff,3=/127.0.0.1:1414 (localhost),4=TCP]
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.receiveTSH(RemoteConnection.java:3291)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1411)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:1007)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:155)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1724)
... 18 more
This Question appears to point at a jar file difference, but I'm using the identical client in both cases. Seems like there must be a difference in defaults from the command line vs the MQExplorer
.