Reputation: 13
I face this MQJE001: Completion Code '2', Reason '2538' when I create new MQQueueManager using hashmaps,
here is my code snippet:
I run using this code:
static private int PORT = 1417;
static private String HOST = "localhost";
static private String QMANAGER = "QM1";
static private String QUEUE = "Q1";
static private Hashtable<String, Object> props = new Hashtable<String, Object>();
static MQQueueManager qMgr = null;
props.put(MQConstants.CHANNEL_PROPERTY, CHANNEL);
props.put(MQConstants.PORT_PROPERTY, PORT);
props.put(MQConstants.HOST_NAME_PROPERTY, HOST);
MQQueueManager qMgr = null;
qMgr = new MQQueueManager(QMANAGER, props);
int openOptions = MQConstants.MQOO_OUTPUT;
MQQueue queue = qMgr.accessQueue(QUEUE, openOptions);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQConstants.MQPMO_ASYNC_RESPONSE;
// create message
MQMessage mqMessage = new MQMessage();
String message ="Test";
System.out.println("Writing message to queue: " + QUEUE);
// Message Send
mqMessage.writeString(message);
queue.put(mqMessage, pmo);
queue.close();
Upvotes: 1
Views: 294
Reputation: 7476
Did you start the MQ listener on port 1417? Update your question with either a screenshot from MQ Explorer or from issuing the MQSC command:
DIS LSSTATUS(*)
then take what was returned and issue the following MQSC command:
DIS LISTENER(???)
where ??? is the listener name from the listener status command.
You are using 'localhost' for the host value. Did you try 127.0.0.1 because localhost may not be defined in your 'hosts' file.
As Josh asked you, can you telnet to port 1417? If not then you will need to open a port in your firewall.
Upvotes: 1