【发布时间】:2018-04-21 17:25:39
【问题描述】:
通过 .NET 客户端访问 MQ 服务器时出现以下错误。创建 CCDT 时不询问登录凭据。但是 MQ 服务器出于某种原因正在寻找它。
我找不到任何同时涵盖 CCDT 和以下错误的信息。
IBM.WMQ.MQException: MQRC_NOT_AUTHORIZED
----- cmqxrsrv.c : 2356 -------------------------------------------------------
17/04/2018 23:50:44 - Process(1848.16) User(SYSTEM) Program(amqzlaa0.exe)
Host(APPLE) Installation(Installation1)
VRMF(8.0.0.5) QMgr(LocalQM)
AMQ5540: Application 'bin\Debug\Producer.exe' did not supply a user ID
and password
EXPLANATION:
The queue manager is configured to require a user ID and password, but none was
supplied.
ACTION:
Ensure that the application provides a valid user ID and password, or change
the queue manager configuration to OPTIONAL to allow applications to connect
which have not supplied a user ID and password.
----- amqzfuca.c : 4311 -------------------------------------------------------
17/04/2018 23:50:44 - Process(1848.16) User(SYSTEM) Program(amqzlaa0.exe)
Host(APPLE) Installation(Installation1)
VRMF(8.0.0.5) QMgr(LocalQM)
AMQ5541: The failed authentication check was caused by the queue manager
CONNAUTH CHCKCLNT(REQDADM) configuration.
EXPLANATION:
The user ID 'mqclient' and its password were checked because the user ID is
privileged and the queue manager connection authority (CONNAUTH) configuration
refers to an authentication information (AUTHINFO) object named
'SYSTEM.DEFAULT.AUTHINFO.IDPWOS' with CHCKCLNT(REQDADM).
This message accompanies a previous error to clarify the reason for the user ID
and password check.
ACTION:
Refer to the previous error for more information.
Ensure that a password is specified by the client application and that the
password is correct for the user ID. The authentication configuration of the
queue manager connection determines the user ID repository. For example, the
local operating system user database or an LDAP server.
To avoid the authentication check, you can either use an unprivileged user ID
or amend the authentication configuration of the queue manager. You can amend
the CHCKCLNT attribute in the CHLAUTH record, but you should generally not
allow unauthenticated remote access.
-------------------------------------------------------------------------------
17/04/2018 23:50:45 - Process(14900.9) User(SYSTEM) Program(amqrmppa.exe)
Host(APPLE) Installation(Installation1)
VRMF(8.0.0.5) QMgr(LocalQM)
AMQ9557: Queue Manager User ID initialization failed for 'mqclient'.
EXPLANATION:
The call to initialize the User ID 'mqclient' failed with CompCode 2 and Reason
2035.
ACTION:
Correct the error and try again.
----- cmqxrsrv.c : 2356 -------------------------------------------------------
服务器设置
通过以下链接创建CCDT文件:
Setting up the server using IBM MQ Explorer
Server-connection Channel: LOCAL.DEF.SVRCONN
MCA User ID: empty
Setting up the client using IBM MQ Explorer
Clinet channe: LOCAL.DEF.SVRCONN
Queue Manager name: LocalQM
Connection name: 192.168.1.9(1415)
192.168.1.9 是本地主机地址
1415 是队列管理器,LocalQM,TCP 端口。
设置 CCDT 环境
1
C:\Users\'#.lp\source>SET MQCHLLIB=C:\ProgramData\IBM\MQ\qmgrs\LocalQM\@ipcc
C:\Users\'#.lp\source>SET MQCHLTAB=AMQCLCHL.TAB
-
将 AMQCLCHL.TAB 也放入 C:\ProgramData\IBM\MQ (我不知道为什么哪个可能不正确,因为日志文件出错:
AMQ9518:找不到文件“C:\ProgramData\IBM\MQ\AMQCLCHL.TAB”。
)
IBM MQ.NET
下面的代码来自here
MQQueueManager qm = null;
System.Environment.SetEnvironmentVariable("MQCHLLIB", "C:\\ProgramData\\IBM\\MQ\\qmgrs\\LocalQM\\@ipcc");
System.Environment.SetEnvironmentVariable("MQCHLTAB", "AMQCLCHL.TAB");
try
{
Hashtable props = new Hashtable();
props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
qm = new MQQueueManager("LocalQM",props);
MQQueue queue1 = qm.AccessQueue("LocalQueue", MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING);
MQMessage msg = new MQMessage();
msg.WriteUTF("Hello this message is from .net client");
queue1.Put(msg);
queue1.Close();
qm.Disconnect();
}
catch (Exception ex)
{
Console.Write(ex);
}
Windows 10 上的 IBM MQ V8
Windows 10 上的 MQ.NET 客户端 V8
Creating a client channel definition table
Using a client channel definition table with .NET
更新 1
点击下面的链接。但似乎 MQ 服务器没有使用 mqccred.ini 上的信息。因为发生同样的错误。
Client side security exit to insert user ID and password ( mqccred )
设置步骤:
1 创建 mqccred.ini (D:\mqccred.ini)
QueueManager:
Name=LocalQM
User=mqclient
password=password
2 设置 Windows 环境变量
set MQCCRED=D:\mqccred.ini
3 使用 mqccred
DEFINE CHANNEL(LOCAL.DEF.SVRCONN) CHLTYPE(clntconn) +
CONNAME(127.0.0.1) +
QMNAME(LocalQM) +
SCYEXIT('mqccred(ChlExit)') +
REPLACE
4 设置 ADOPTCTX(YES)
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) ADOPTCTX(YES)
更新 2
我将 MQ 对象更新为大写,仍然得到与上面相同的错误,但下面有新的错误日志消息:
是否需要根据Using channel exits in IBM MQ .NET在.NET中编写退出程序?
22/04/2018 22:37:15 - Process(11904.1) User('#.lp) Program(mMq.Producer.exe)
Host(APPLE) Installation(Installation1)
VRMF(8.0.0.5)
AMQ9535: User exit not valid.
EXPLANATION:
Channel program 'LOCAL.DEF.SVRCONN' ended because user exit 'mqccred(ChlExit)'
is not valid.
Architecture of the exit library does not match the process's architecture
which is '' bit.
ACTION:
Ensure that the user exit is specified correctly in the channel definition, and
that the user exit program is correct and available.
----- IBM.WMQ.MQChannelExitHandler.LoadExit : 0 -------------------------------
22/04/2018 22:38:21 - Process(5720.1) User('#.lp) Program(mMq.Producer.exe)
Host(APPLE) Installation(Installation1)
VRMF(8.0.0.5)
AMQ9535: User exit not valid.
EXPLANATION:
Channel program 'LOCAL.DEF.SVRCONN' ended because user exit 'mqccred(ChlExit)'
is not valid.
Architecture of the exit library does not match the process's architecture
which is '' bit.
ACTION:
Ensure that the user exit is specified correctly in the channel definition, and
that the user exit program is correct and available.
----- IBM.WMQ.MQChannelExitHandler.LoadExit : 0 -------------------------------
更新 3
当 MCA 用户 ID 设置为 Windows 用户时,我在下面遇到不同的错误。
IBM.WMQ.MQException: MQRC_Q_MGR_NOT_AVAILABLE
22/04/2018 22:38:21 - Process(5720.1) User('#.lp) Program(mMq.Producer.exe)
Host(APPLE) Installation(Installation1)
VRMF(8.0.0.5)
AMQ9535: User exit not valid.
EXPLANATION:
Channel program 'LOCAL.DEF.SVRCONN' ended because user exit 'mqccred(ChlExit)'
is not valid.
Architecture of the exit library does not match the process's architecture
which is '' bit.
ACTION:
Ensure that the user exit is specified correctly in the channel definition, and
that the user exit program is correct and available.
----- IBM.WMQ.MQChannelExitHandler.LoadExit : 0 -------------------------------
更新 4
很抱歉给您带来了困惑。更新 2 和 3 相同。两个更新应该有相同的错误:MQRC_Q_MGR_NOT_AVAILABLE,在更新 1 之后出现。我错误地输入了 MQRC_NOT_AUTHORIZED。
【问题讨论】:
-
评论不用于扩展讨论;这个对话是moved to chat。
-
很抱歉给您带来了困惑,请参阅更新 4 进行解释。 2 和 3 是同一个错误。
-
萍萍,你搞定了吗?
-
Pingpong,你搞定了吗?如果是这样,请接受一个有帮助的答案,如果您认为这是一个好的答案,请点赞。
-
尚未尝试,在 .NET 中编写自己的退出会更复杂。我开始怀疑是否有比使用 exit 更好的方法来使用 CCDT。