ibm - How to start Websphere Mq Service? -


i using web sphere version 7.5,does require system broker starting mq service.how can start mq service when access through java code. getting following exceptions when access through code

mqje001: mqexception occurred: completion code 2, reason 2009 mqje016: mq queue manager closed channel during connect closure reason = 2009

mqje001: mqexception occurred: completion code 2, reason 2009 mqje016: mq queue manager closed channel during connect closure reason = 2009

com.ibm.mq.mqexception: mqje001: mqexception occurred: completion code 2, reason 2009

mqje016: mq queue manager closed channel during connect closure reason = 2009

the code used given below

public class demo {             private mqqueuemanager _queuemanager = null;             public int port = 1422;             public string hostname = "192.168.1.5";//ip of host             public string channel = "qm_orange.qm_apple";//channel name             public string qmanager = "qm_orange";//queue manager name             public string inputqname = "q1";//remote q type             public string outputqname = "qm_apple";//queue manager              public demo() {                 super();             }              private void init(string[] args) throws illegalargumentexception {                 // set mq environment                 mqenvironment.hostname = hostname;                 mqenvironment.channel = channel;                 mqenvironment.port = port;             }              public static void main(string[] args) {                  demo readq = new demo();                  try {                     readq.init(args);                     readq.selectqmgr();                     readq.read();                     readq.write();                 } catch (illegalargumentexception e) {                     system.out                             .println("usage: java mqread <-h host> <-p port> <-c channel> <-m queuemanagername> <-q queuename>");                     system.exit(1);                 } catch (mqexception e) {                     system.out.println(e);                     system.exit(1);                 }             }              private void read() throws mqexception {                 int openoptions = mqc.mqoo_inquire + mqc.mqoo_fail_if_quiescing                         + mqc.mqoo_input_shared;                  mqqueue queue = _queuemanager.accessqueue(inputqname, openoptions,                         null, // default q manager                         null, // no dynamic q name                         null); // no alternate user id                  system.out.println("mqread v1.0 connected.\n");                  int depth = queue.getcurrentdepth();                 system.out.println("current depth: " + depth + "\n");                 if (depth == 0) {                     return;                 }                  mqgetmessageoptions getoptions = new mqgetmessageoptions();                 getoptions.options = mqc.mqgmo_no_wait + mqc.mqgmo_fail_if_quiescing                         + mqc.mqgmo_convert;                 while (true) {                     mqmessage message = new mqmessage();                     try {                         queue.get(message, getoptions);                         byte[] b = new byte[message.getmessagelength()];                         message.readfully(b);                         system.out.println(new string(b));                         message.clearmessage();                     } catch (ioexception e) {                         system.out.println("ioexception during get: " + e.getmessage());                         break;                     } catch (mqexception e) {                         if (e.completioncode == 2                                 && e.reasoncode == mqexception.mqrc_no_msg_available) {                             if (depth > 0) {                                 system.out.println("all messages read.");                             }                         } else {                             system.out.println("get exception: "+e);                         }                         break;                     }                 }                 queue.close();                 _queuemanager.disconnect();             }              private void selectqmgr() throws mqexception {                 _queuemanager = new mqqueuemanager(qmanager);             }              private void write() throws mqexception {                 int linenum = 0;                 int openoptions = mqc.mqoo_output + mqc.mqoo_fail_if_quiescing;                 try {                     mqqueue queue = _queuemanager.accessqueue(outputqname, openoptions,                             null, // default q manager                             null, // no dynamic q name                             null); // no alternate user id                      datainputstream input = new datainputstream(system.in);                      system.out.println("mqwrite v1.0 connected");                     system.out.println("and ready input, terminate ^z\n\n");                      // define simple mq message, , write text in utf format..                     mqmessage sendmsg = new mqmessage();                     sendmsg.format = mqc.mqfmt_string;                     sendmsg.feedback = mqc.mqfb_none;                     sendmsg.messagetype = mqc.mqmt_datagram;                     sendmsg.replytoqueuename = "roger.queue";                     sendmsg.replytoqueuemanagername = qmanager;                      mqputmessageoptions pmo = new mqputmessageoptions(); // accept                                                                             // defaults,                                                                             // same                     // mqpmo_default constant                      string line = "test message";                     sendmsg.clearmessage();                     sendmsg.messageid = mqc.mqmi_none;                     sendmsg.correlationid = mqc.mqci_none;                     sendmsg.writestring(line);                      // put message on queue                      queue.put(sendmsg, pmo);                     system.out.println(++linenum + ": " + line);                      queue.close();                     _queuemanager.disconnect();                  } catch (com.ibm.mq.mqexception mqex) {                     system.out.println(mqex);                 } catch (java.io.ioexception ioex) {                     system.out.println("an mq io error occurred : " + ioex);                 }              }         } 

i got following error log 9/24/2016 14:09:24 - process(1956.7) user(musr_mqadmin) program(amqrmppa.exe) host(abhi-pc) installation(installation1) vrmf(7.5.0.2) qmgr(qm_orange)

amq9208: error on receive host aneesh (192.168.0.7).

explanation: error occurred receiving data aneesh (192.168.0.7) on tcp/ip. may due communications failure. action: return code tcp/ip recv() call 10054 (x'2746'). record these values , tell systems administrator.

your application calling _queuemanager.disconnect() in read method. closes connection queue manager. application calling accessqueue method using same disconnected _queuemanager object. fail connection error.

suggest remove queuemanager.disconnect() read method , try.

update

couple of suggestions:

1) set transport type client adding line mqenvironment.properties.put(mqconstants.transport_property,cmqc.transport_mqseries_client)

2) ensure channel, qm_orange.qm_apple using server connection (svrconn) type channel.

this question may of help: mq queue manager closed channel during connect


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -