gpt4 book ai didi

java - 从 Java 客户端连接到 IBM MQ 失败,并显示 MQJE001 : Completion Code '2' , 原因 '2035'

转载 作者:行者123 更新时间:2023-12-01 18:02:46 25 4
gpt4 key购买 nike

我在 Windows 7 中安装了 IBM MQ 版本 7.5。我使用以下命令创建了队列管理器、 channel 和监听器。

//CREATE THE QUEUE MANAGER
crtmqm.exe PG3RT1

//START THE QUEUE MANAGER AS INTERACTIVE
strmqm.exe -si PG3RT1

//CONNECT AS SCRIPT CONSOLE
runmqsc.exe PG3RT1

//CREATE THE CHANNEL TO APPLICATION CONNECTIVITY
DEFINE CHANNEL(PG3RT1.CHANNEL) CHLTYPE(SVRCONN) TRPTYPE(TCP)

//CREATE THE LISTENER
DEFINE LISTENER(LISTENER.PG3RT1) TRPTYPE(TCP) PORT(1414)

//START THE LISTENER
START LISTENER(LISTENER.PG3RT1)

现在我尝试使用以下 java 客户端连接到队列管理器。连接被拒绝并出现以下错误。

    15:06:52.175 [localhost-startStop-1] ERROR c.b.c.s.s.m.MQUtil - MQJE001: Completion Code '2', Reason '2035'.
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2035'.
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:230)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:553)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:593)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:96)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:198)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:893)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:780)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:729)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:177)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:745)
at com.bcs.cas.sach.simulator.mq.MQUtil.init(MQUtil.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)

任何人都可以告诉为什么连接失败。我需要在队列管理器上启用远程管理吗?

以下是我用于连接的代码片段

public void init(){
MQEnvironment.hostname = hostName;
MQEnvironment.port = Integer.valueOf(port);
MQEnvironment.channel = serverChannelName;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
LOGGER.info("queueManagerName: " + queueManagerName);
LOGGER.info("hostName: " + hostName);
LOGGER.info("serverChannelName: " + serverChannelName);
LOGGER.info("port: " + port);
//initialize the connection pool
MQPoolToken token = MQEnvironment.addConnectionPoolToken();
try {
mqQueueManager = new MQQueueManager(queueManagerName, MQEnvironment.properties);
LOGGER.info("mqQueueManager: " + mqQueueManager);
} catch (MQException e) {
LOGGER.error(e.getMessage(), e);
}
}

最佳答案

MQRC 2035 是 MQRC_NOT_AUTHORIZED。返回的原因可以在队列管理器上的 AMQERR 日志中找到。

由于 CHLAUTH 尚未配置,并且默认情况下处于启用状态,我预计您将无法连接,因为您没有通过 CHLAUTH 规则。

关于java - 从 Java 客户端连接到 IBM MQ 失败,并显示 MQJE001 : Completion Code '2' , 原因 '2035',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39405911/

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