java - 使用 Java 通过 SSL 连接 MQ7.X

标签 java ssl ibm-mq

我们需要使用 java 独立程序通过 SSL 连接到 MQ。我们已经从合作伙伴那里收到了 .arm 文件,并且我们已经使用 keytool 命令安装了证书,如下所示:

/opt/jdk1.8.0_121/bin/keytool -import -alias my_cert -file mycert.arm -keystore /opt/jdk1.8.0_121/jre/lib/security/cacerts

Enter keystore password:
---
---
----
Trust this certificate? [no]:  yes
Certificate was added to keystore

在java中连接队列管理器的程序

MQEnvironment.hostname = "XX.XX.XX.XX";
MQEnvironment.channel = "Channel_Name"; // With  SSL
MQEnvironment.port = XXXX;

System.setProperty("javax.net.debug", "ssl");
System.setProperty("javax.net.ssl.trustStore", "/opt/jdk1.8.0_121/jre/lib/security/cacerts");
System.setProperty("javax.net.ssl.trustStorePassword", "trustpass");
MQEnvironment.sslCipherSuite = "SSL_RSA_WITH_RC4_128_SHA";

_queueManager = new MQQueueManager("QueueManagerName");

System.out.println("\t _queueManager                        : " + _queueManager);

错误如下所示

keyStore type is : jks
keyStore provider is :
init keystore
init keymanager of type SunX509
MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE013: Error accessing socket streams
MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE013: Error accessing socket streams
Exception in thread "main" com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE013: Error accessing socket streams
        at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:212)

能否请您帮助我们解决这个问题。

最佳答案

根据 this thread 原因 2059 与未运行的监听器服务有关。

Figured out the problem. There is a "HTTP SSL" service, which apparently needs to be running. When the box was rebooted, it wasn't started. Starting the service, and re-starting the WAS server fixed the problem.

关于java - 使用 Java 通过 SSL 连接 MQ7.X,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43002195/

相关文章:

java - Selenium 上传文件 : file not found [docker]

ssl - 我能否将通知从 WP8 推送到 Windows 应用商店应用程序?

java - 如何同时调用所有 `Mono<E>`

ssl - iOS 8 在我的应用程序中断开了 SSL 连接 - CFNetwork SSLHandshake 失败 (-9806)

google-chrome - SSL 网站仍然说有不安全的内容

java - 当服务器再次启动时自动恢复与主队列的连接

debian - 如何在 Debian 服务器上安装 Websphere MQ 客户端?

ibm-mq - websphere mq 中的队列存储文件系统已满

java - 如何在J2ME中创建ComboBox?

java - 检查数字是否完全平方