Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MQJE001: Completion Code '2', Reason '2538'

Tags:

java

ibm-mq

public class PtpReceiver {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    try {
        MQEnvironment.hostname = "192.168.120.28:1415";
        MQEnvironment.channel = "SFMS.TO.CBS";
        MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
                MQC.TRANSPORT_MQSERIES);
        System.out.println("Q manager");
        MQQueueManager qMgr = new MQQueueManager("GSCBBRQM");
        System.out.println("Q manager11");

    }

    catch (MQException ex) {
        System.out.println(ex.completionCode+ ex.reasonCode);
        }
}

}

I got the error following:

MQJE001: Completion Code '2', Reason '2538'.

Can any one help me for solve this error

like image 546
Bhaumik Shah Avatar asked Feb 10 '14 09:02

Bhaumik Shah


3 Answers

That is JMS code for doing a connection via for WMQ for JMS. Bhaumik is using WMQ for Java (non JMS).

Bhaumik, you do not specify the port number in the hostname but rather as follows:

public static void main(String[] args) {
    try {
        MQEnvironment.hostname = "192.168.120.28";
        MQEnvironment.port     = 1415;
        MQEnvironment.channel  = "SFMS.TO.CBS";
        MQQueueManager qMgr = new MQQueueManager("GSCBBRQM");
    }

    catch (MQException ex) {
        System.out.println("CC="+ex.completionCode + " : RC="+ ex.reasonCode);
        }
}
like image 183
Roger Avatar answered Nov 17 '22 18:11

Roger


I think it is necessary to define your connection mode like this:

jmsFactory = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
jcf = jmsFactory.createConnectionFactory();

// Set the properties
jcf.setStringProperty(WMQConstants.WMQ_HOST_NAME, hostName);
jcf.setIntProperty(WMQConstants.WMQ_PORT, port);
jcf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
jcf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);

connection = jcf.createConnection();

I hope it works. For more inormation see this.

like image 22
Aliti Avatar answered Nov 17 '22 16:11

Aliti


You can try to provide your connection properties as HashTable as follows.

  Hashtable<String, Object> mqht = new Hashtable<>();
  mqht.put(MQConstants.HOST_NAME_PROPERTY, "199.40.166.193");
  mqht.put(MQConstants.PORT_PROPERTY, 1414); // Port should be as int value, don't use String.
  mqht.put(MQConstants.CHANNEL_PROPERTY, "A2A");

  MQQueueManager qMgr = null;

  try {
     qMgr = new MQQueueManager(queueManager, mqht);
  } catch (MQException ex) {
     System.out.println(ex.getMessage());
  }
like image 1
Udara C Amarasinghe Avatar answered Nov 17 '22 17:11

Udara C Amarasinghe