从 Java 使用 IBM MQ
work with IBM MQ from Java
我在来自 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
规则。以下 link 提供了有关 create/modify CHLAUTH
的详细信息
如果您想了解有关 CHLAUTH 的更多详细信息,请阅读以下 link:
CHLAUTH Made Simple: Common Scenarios and Examples and How to Verify them with RUNCHECK
mqConnection = cf.createQueueConnection()
您 should/need 传递连接的用户 ID 和密码。
即
mqConnection = cf.createQueueConnection("myUserId", "mypwd");
我在来自 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
规则。以下 link 提供了有关 create/modify CHLAUTH
如果您想了解有关 CHLAUTH 的更多详细信息,请阅读以下 link:
CHLAUTH Made Simple: Common Scenarios and Examples and How to Verify them with RUNCHECK
mqConnection = cf.createQueueConnection()
您 should/need 传递连接的用户 ID 和密码。
即
mqConnection = cf.createQueueConnection("myUserId", "mypwd");