Ive just spent a day resolving a problem with specifying a port value trying to connect to MQ.
I had
public long port = 1414;
String channel = “MYCHANNEL”;
String hostname = “127.0.0.1”;
Hashtable<String, Object> h = new Hashtable<String, Object>();
h.put(MQConstants.PORT_PROPERTY, dd.port);h.put(MQConstants.CHANNEL_PROPERTY, channel);
h.put(MQConstants.TRANSPORT_PROPERTY, MQConstants.TRANSPORT_MQSERIES_CLIENT);
h.put(MQConstants.HOST_NAME_PROPERTY, hostname);
queueManager = new MQQueueManager(“QMA”,h);
(did you spot the problem?)
This failed with
MQConnection to QMA com.ibm.mq.MQException: MQJE001: Completion Code ‘2’, Reason ‘2538’.
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host ‘127.0.0.1(0)’ rejected.
This is saying it tried to connect with port 0!
I tried
String port = “1414”;, that failed the same way.
If I used
MQEnvironment.port=”1414″; it worked.
This was tough to resolve, as there is no documentation to help me.
Someone suggested public int port = 1414; and it worked! What a way to spend a nice autumn day.