|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Unable to get SSL Working in base Java |
« View previous topic :: View next topic » |
Author |
Message
|
tnana |
Posted: Wed Nov 17, 2010 12:03 pm Post subject: Unable to get SSL Working in base Java |
|
|
Novice
Joined: 06 Oct 2004 Posts: 14
|
Java Code (found here and modified):
===============================================
import com.ibm.mq.*;
public class SSL_SAMPLE {
public static void main(String[] args) {
System.setProperty("javax.net.ssl.keyStore", "c:\\temp\\trustStore.jks");
System.setProperty("javax.net.ssl.keyStorePassword","pwd");
System.setProperty("javax.net.ssl.trustStore","c:\\temp\\trustStore.jks");
System.setProperty("javax.net.ssl.trustStorePassword","pwd");
MQEnvironment.sslCipherSuite = "SSL_RSA_WITH_NULL_MD5";
MQEnvironment.hostname ="mqhost";
MQEnvironment.port = 4515;
MQEnvironment.channel = "CLIENT.SERVER";
MQQueueManager qm = null;
try {
qm = new MQQueueManager("QM1");
Thread.sleep(1541111244);
} catch (MQException e) {
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
qm.disconnect();
} catch (MQException e) {e.printStackTrace();
}}}}
===============================================
Getting following errors:
========================================
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
com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Rea
son 2059
MQJE013: Error accessing socket streams
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:
212)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnecti
on(MQClientManagedConnectionFactoryJ11.java:318)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnectio
n(MQClientManagedConnectionFactoryJ11.java:338)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.jav
a:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConne
ctionManager.java:168)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueMana
gerFactory.java:772)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:6
97)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManager
Factory.java:657)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFac
tory.java:153)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:451)
at SSL_SAMPLE.main(SSL_SAMPLE.java:16)
Caused by: com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion
Code 2, Reason 2059
MQJE013: Error accessing socket streams
at com.ibm.mq.SSLHelper.createSSLSocketInstance(SSLHelper.java:497)
at com.ibm.mq.SSLHelper.createSSLSocket(SSLHelper.java:134)
at com.ibm.mq.MQInternalCommunications.createSocketConnection(MQInternal
Communications.java:2264)
at com.ibm.mq.MQv6InternalCommunications$1.run(MQv6InternalCommunication
s.java:157)
at java.security.AccessController.doPrivileged(AccessController.java:242
)
at com.ibm.mq.MQv6InternalCommunications.initialize(MQv6InternalCommunic
ations.java:154)
at com.ibm.mq.MQv6InternalCommunications.<init>(MQv6InternalCommunicatio
ns.java:102)
at com.ibm.mq.MQSESSIONClient.MQCONNX(MQSESSIONClient.java:1337)
at com.ibm.mq.MQSESSIONClient.MQCONN(MQSESSIONClient.java:1246)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:
184)
... 10 more
Exception in thread "main" java.lang.NullPointerException
at SSL_SAMPLE.main(SSL_SAMPLE.java:25)
===============================================
===== Configuration for test ================
Server - MQ 6 on Linux.
Client - Java+MQ 6 on W2K3
SSLKEYR = /var/mqm/qmgrs/QM1/ssl/key
This key.kdb database on server contains CA certificate (MQ_CA_CERT) and Queue Mnager's personal certificate (ibmwebspheremqqm1)
On W2K3 machine, created trustStore.jks in "C:\Temp". Added CA certificate (for some reason label shows as "mq_ca_cert" although typed in uppercase). Also added personal certificate with label "ibmwebspheremqtestuser".
We also ran Wireshark and don't see a single packet being sent to server hosting Queue Manager. |
|
Back to top |
|
 |
gs |
Posted: Tue Nov 23, 2010 6:13 am Post subject: |
|
|
 Master
Joined: 31 May 2007 Posts: 254 Location: Sweden
|
The code looks fine, verify the queue manager parameters and the passwords for the trust store.
By some reason you'll get a 2059 if you provide the wrong password for the trust/key stores. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 23, 2010 6:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If it's not an issue with the password for the keystore/truststore, it's almost certainly an issue with the local firewall on the machine not letting you access the network.
The MQ client will log messages to the local system, you should look for them in the documented location. It may provide additional information. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|