简体   繁体   中英

Connecting MQ7.X over SSL using java

We need to connect to MQ over SSL by using java standalone program. We have received .arm file from the Partner and we have installed the certificate using keytool command as given below:

/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

Program to connect Queue Manager in 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);

Error getting as given below

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)

Can you please help us to resolve this issue.

According to this thread Reason 2059 relates to a non-running listener service.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM