【问题标题】:Always receive MQJE001: Completion Code '2', Reason '2059'. ERROR始终收到 MQJE001:完成代码“2”,原因“2059”。错误
【发布时间】:2012-06-29 13:07:55
【问题描述】:

我是 Web Sphere MQ 的新手。

我在 AIX 中创建了队列管理器、通道和侦听器,如下所示:

crtmqm MY_Q_MGR

strmqm MY_Q_MGR

runmqsc

DEFINE LISTENER(MY_QM_LISTENER) TRPTYPE(TCP) PORT(5030)

DEFINE CHANNEL(MY_QM_CHANNEL) CHLTYPE(SDR) CONNAME('10.128.1.51(5030)') XMITQ('MY_Q_MGR') DISCINT(0)

然后我检查了 QMGR 是否正在运行。我在 proc 中看到了监听器。

然后,我尝试从 java 创建 MQQueueManager,如下所示,我得到了MQJE001: Completion Code '2', Reason '2059'.

import com.ibm.mq.MQException;
import com.ibm.mq.MQGetMessageOptions;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.MQConstants;
import com.ibm.mq.MQEnvironment;

public class MQSample {

  // code identifier
  static final String sccsid = "@(#) samples/wmqjava/MQSample.java, jmscc.samples, k700, k700-L080529 1.4.1.1 08/06/01 09:37:53";

    // define the name of the QueueManager
     private static final String qManager = "MY_Q_MGR";

  // and define the name of the Queue
  private static final String qName = "SYSTEM.DEFAULT.LOCAL.QUEUE";

  /**
   * Main entry point
   * 
   * @param args - command line arguments (ignored)
   */
  public static void main(String args[]) {
    try {
        MQEnvironment.hostname = "MY IP ADDRESS";
        MQEnvironment.channel = "MY_QM_CHANNEL";
        MQEnvironment.port = 5030;


      // Create a connection to the QueueManager
      System.out.println("Connecting to queue manager: " + qManager);
      System.out.println("Connecting to queue manager is finished: " + qManager);
      // Set up the options on the queue we wish to open
      int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;

      // Now specify the queue that we wish to open and the open options
      System.out.println("Accessing queue: " + qName);
      MQQueue queue = qMgr.accessQueue(qName, openOptions);
      MQQueueManager qMgr = new MQQueueManager(qManager); // here i got error
      System.out.println("Connecting to queue manager is finished: " + qManager);
      // Set up the options on the queue we wish to open
      int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;

      // Now specify the queue that we wish to open and the open options
      System.out.println("Accessing queue: " + qName);
      MQQueue queue = qMgr.accessQueue(qName, openOptions);

我被困在这里了。

【问题讨论】:

    标签: java ibm-mq websphere-7


    【解决方案1】:

    您需要一个服务器连接 (SVRCONN) 类型的通道,而不是 SDR 类型。客户端应用程序需要SVRCONNtype 通道才能连接到队列管理器,其中SDR 类型通道用于两个队列管理器之间的通信。

    创建队列管理器时,会创建默认 SVRCONN 通道 SYSTEM.DEF.SVRCONN。您可以将其用于您的测试。但在生产环境中,建议您创建自己的频道,不要使用任何预定义的频道。

    请参阅link 了解您需要做什么的完整详细信息。这是来自 WebSphere MQ 快速入门书。

    【讨论】:

    • 非常感谢。我刚刚让程序运行了。
    猜你喜欢
    • 2014-03-07
    • 1970-01-01
    • 1970-01-01
    • 2011-06-27
    • 1970-01-01
    • 1970-01-01
    • 2021-05-06
    • 2021-06-08
    相关资源
    最近更新 更多