【发布时间】:2018-04-25 11:15:20
【问题描述】:
我使用 IBM MQ V7.5 客户端并运行 Java 1.7 编写了一个带有 SSL 配置的 Java 客户端。为此,我参考了 SSL configuration of the Websphere MQ Java/JMS client,但在 Create TrustStore 步骤 8 中,我使用了自签名证书。 (因为我没有 CA 的证书,我在哪里获得 CA 的证书?)
我的客户端 Java 代码是
import com.ibm.mq.*;
import com.ibm.mq.constants.MQConstants;
public class MQProducer {
private static final String qManager = "QM1";
private static final String qName = "localq";
private static final String truloc = "C:\\Program Files (x86)\\IBM\\WebSphere MQ\\Qmgrs\\QM1\\ssl\\trustStore.jks";
private static final String keyloc = "C:\\Program Files (x86)\\IBM\\WebSphere MQ\\Qmgrs\\QM1\\ssl\\keyStore.jks";
public static void main(String args[]) {
try {
MQEnvironment.hostname = "192.168.43.5";
MQEnvironment.channel = "myChannel";
MQEnvironment.port = 1414;
MQEnvironment.userID = "Taneesha";
System.setProperty("javax.net.ssl.trustStore", truloc);
System.setProperty("javax.net.ssl.keyStore", keyloc);
System.setProperty("javax.net.ssl.keyStorePassword", "123456");
MQEnvironment.sslCipherSuite = "SSL_RSA_WITH_NULL_MD5";
MQQueueManager qMgr = new MQQueueManager(qManager);
int openOptions = MQConstants.MQOO_OUTPUT;
MQQueue queue = qMgr.accessQueue(qName, openOptions);
MQMessage msg = new MQMessage();
String message = "Hello world";
msg.writeUTF(message);
MQPutMessageOptions pmo = new MQPutMessageOptions();
queue.put(msg, pmo);
queue.close();
qMgr.disconnect();
} catch (MQException ex) {
ex.printStackTrace();
System.out.println("A WebSphere MQ Error occurred : Completion Code " + ex.completionCode
+ " Reason Code " + ex.reasonCode);
} catch (java.io.IOException ex) {
System.out.println("An IOException occurred whilst writing to the message buffer: " + ex);
}
}
}
我收到以下错误
MQJE001: Completion Code '2', Reason '2397'.
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;
AMQ9204: Connection to host '192.168.43.5(1414)' rejected.
[1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2397;
AMQ9771: SSL handshake failed.
[1=javax.net.ssl.SSLHandshakeException[No appropriate protocol
(protocol is disabled or cipher suites are inappropriate)],
3=kasun-PC/192.168.43.5:1414 (kasun-PC),
4=SSLSocket.startHandshake,
5=default]],
3=192.168.43.5(1414),
5=RemoteTCPConnection.protocolConnect]
请有人帮忙吗?
【问题讨论】:
-
我正在使用 MQ V7.5 并运行 java 1.7