我使用下面的代码连接IBM MQ ...
public static void CreateConnectionWithBARXMQ()
{
XMSFactoryFactory factoryFactory;
IConnectionFactory cf = null;
factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
cf = factoryFactory.CreateConnectionFactory();
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, <some-host-name>);
cf.SetIntProperty(XMSC.WMQ_PORT, 1422);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, <some-channel>);
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, <some-manager>);
cf.SetStringProperty(XMSC.WMQ_QUEUE_NAME, <some-queue>);
cf.SetIntProperty(XMSC.WMQ_QMGR_CCSID, XMSC.CCSID_UTF8);
IConnection connection = cf.CreateConnection();
}
此代码适用于不安全的MQ通道。但是当我将频道从不安全的频道更改为安全频道和安全退出代码时,如下所述...
cf.SetStringProperty(XMSC.WMQ_SECURITY_EXIT, @"C:\Program Files\IBM\WebSphere MQ\exits\BCPKIJCExit_70R.dll");
它抛出非常一般的错误......
CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2195
. During execution of the specified method an exception was thrown by another component. See the linked exception for more information.
我检查了链接的异常,但它有与上面相同的错误消息。
谁能告诉我这里有什么问题。
答案 0 :(得分:1)
2195 return code
是一个高级异常,当代码中的较低级别未捕获到错误时会触发该异常。通常,当某些外部依赖项(如文件访问或 Os资源 )的行为不符合预期且故障级联为{{1 }}
答案 1 :(得分:0)
你需要回答一堆问题:
答案 2 :(得分:0)
据我所知,您需要一些证书才能使用安全的XMS 通信。 当我尝试与错误的 ssl证书建立安全的XMS通信时,我遇到了同样的错误(2195)。 正如user01928374655647382910019283所说错误是完全不明确的,我很幸运能够重新创建证书!
缺少 ssl证书上发生的错误更加清晰,如“.. ssl repository not found ...”
在我的客户端(v MQ 7.5)我必须按如下方式指定它们
我的示例代码看起来像
...
// Get an instance of factory.
factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
// Create WMQ Connection Factory.
cf = factoryFactory.CreateConnectionFactory();
// Set the properties
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, CoreMqConfiguration.Hostname);
cf.SetIntProperty(XMSC.WMQ_PORT, CoreMqConfiguration.Port);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, CoreMqConfiguration.Channel);
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, CoreMqConfiguration.QueueManagerName);
// for secure communication with SSL
cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, CoreMqConfiguration.CipherSpec);
cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, "<path\to\ssl>\key");
// Create connection.
connectionWMQ = cf.CreateConnection();
...
虽然密码规范在我的情况下是
“TLS_RSA_WITH_AES_256_CBC_SHA”
要创建适当的密钥存储库,我使用的是工具
%Program Files(x86)%\ IBM \ Websphere MQ \ bin \ strmqikm.exe。
另外你可以看看 here:
我想它不能立刻解决您的问题,但我希望它有助于建立一个有效且安全的XMS客户端
答案 3 :(得分:0)
com.ibm.mq.MQException:MQJE001:完成代码“ 2”,原因为“ 2195”。
由于数据库密码在接下来的六天内过期而导致的错误。我们重置了数据库密码,问题已解决。