我在通过 java 连接 IBM MQ 时遇到问题
这段代码
val cf: MQQueueConnectionFactory?
var mqConnection: QueueConnection? = null
var session: QueueSession? = null
var sender: QueueSender? = null
var value = ""
try {
cf = MQQueueConnectionFactory()
cf.hostName = host
cf.port = port
cf.queueManager = queueManager
cf.transportType = transport
cf.channel = channelName
cf.clientReconnectOptions = WMQConstants.WMQ_CLIENT_RECONNECT_Q_MGR
cf.clientReconnectTimeout = 3600
mqConnection = cf.createQueueConnection()
drops exception "JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED')"
当我尝试创建连接时cf.createQueueConnection()
我不明白什么是问题。
我使用 ibmmq lib 9.0.2.0 版本,但此代码也不适用于 7.5.0.1 版本
最佳答案
MQRC 2035 表示用户没有适当的权限来连接到队列管理器。可以在队列管理器 errors
目录中的 AMQERR*.log
中找到原因。默认情况下启用 CHLAUTH
。您需要添加 CHLAUTH
规则。以下链接提供了有关创建/修改 CHLAUTH
如果您想了解有关 CHLAUTH 的更多详细信息,请访问以下链接:
CHLAUTH Made Simple: Common Scenarios and Examples and How to Verify them with RUNCHECK
关于java - 从 Java 使用 IBM MQ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51062840/