gpt4 book ai didi

security - 在连接到基本队列时获得 2035

转载 作者:行者123 更新时间:2023-12-05 00:40:51 25 4
gpt4 key购买 nike

我正在运行一个简单的 Java 客户端来连接到远程 MQ 队列。

  • 当我运行 Java 代码以使用别名队列名称读取写入消息时,它工作正常。
  • 当我尝试在同一个队列上运行代码但使用物理队列名称时(因为我希望调用 getQueueDepth),当代码尝试建立连接时出现 2035 错误

  • 队列上的权限是:
    浏览 +dsp +get +inq +put +set +setall

    java代码如下

    导入 com.ibm.mq.MQC;
    导入 com.ibm.mq.MQEnvironment;
    导入 com.ibm.mq.MQException;
    导入 com.ibm.mq.MQGetMessageOptions;
    导入 com.ibm.mq.MQMessage;
    导入 com.ibm.mq.MQPutMessageOptions;
    导入 com.ibm.mq.MQQueue;
    导入 com.ibm.mq.MQQueueManager;
    公共(public)类 MQSniffer {
    /**
    * @param args
    */
    /**
    * @param args
    */
    public static void main(String[] args) {
    String hostname = "XXXX";
    String channel = "CHANNEL";
    String qManager = "qmgr";

    MQQueueManager qMgr;


    MQEnvironment.hostname = hostname;
    MQEnvironment.channel = channel;
    MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);

    try {
    qMgr = new MQQueueManager(qManager);

    int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE | MQC.MQOO_OUTPUT ;

    MQQueue system_default_local_queue =
    qMgr.accessQueue("PHYSICAL_QUEUE_NAME", // *****Get an exception on this call*****
    openOptions,
    null,
    null,
    null);

    System.out.println("****Current Depth is "+ system_default_local_queue.getCurrentDepth());

    MQMessage hello_world = new MQMessage();
    hello_world.writeUTF("Hello World!");


    MQPutMessageOptions pmo = new MQPutMessageOptions();


    system_default_local_queue.put(hello_world,pmo);
    System.out.println("Put the message");


    system_default_local_queue.close();

    // Disconnect from the queue manager

    qMgr.disconnect();

    }

    catch (MQException ex)
    {
    System.out.println("An MQSeries error occurred : Completion code " +
    ex.completionCode +
    " Reason code " + ex.reasonCode);

    ex.printStackTrace();
    }
    catch (java.io.IOException ex)
    {
    System.out.println("An error occurred whilst writing to the message buffer: " + ex);
    }



    }

    }

    om.ibm.mq.MQException:MQJE001:完成代码 2,原因 2035
    在 com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:2858)
    在 org.ku.benchmarkos.MQSniffer.main(MQSniffer.java)

    任何帮助表示赞赏!

    谢谢
    Ĵ

    最佳答案

    WMQ 检查遇到的第一个对象的权限。因此,如果您打开别名,则会检查别名而不是基本队列的权限。如果您打开一个基本队列,则会检查基本队列的权限,而不是任何可能指向它的别名。不期望打开别名的能力意味着打开基本队列的能力。需要对别名和具有适当权限的基本队列运行 setmqaut。

    我在这里发布了更长的解释:Understanding WebSphere MQ authorization and the setmqaut command .

    关于security - 在连接到基本队列时获得 2035,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3397745/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com