ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » problem with connecting java client to MQ with SSL

Post new topic  Reply to topic
 problem with connecting java client to MQ with SSL « View previous topic :: View next topic » 
Author Message
vedantpatil
PostPosted: Fri Oct 14, 2005 8:20 am    Post subject: problem with connecting java client to MQ with SSL Reply with quote

Novice

Joined: 10 Mar 2005
Posts: 19

Our java client program is working on 3 machines and comunicating with the MQ with SSL enabled channel. I have imported certificate to all the 3 machines using

keytool -import -v -noprompt -trustcacerts -alias verisigndemocert -file d:\com\fcib\services\bahbrkp1ca.ascii -keystore D:\jdk1.4.2\j2sdk1.4.2\jre\lib\security\cacerts

But the client program is working fine on 2 machines and on one machine its giving me the following error.
---------------------------------------------------------------------------------
javax.net.ssl.keyStore :\jdk1.4.2\j2sdk1.4.2\jre\lib\security\cacerts
javax.net.ssl.keyStoreType :jks
javax.net.ssl.keyStorePassword:changeit
Connecting to a queue manager
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
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:
239)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnecti
on(MQClientManagedConnectionFactoryJ11.java:276)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnectio
n(MQClientManagedConnectionFactoryJ11.java:296)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.jav
a:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConne
ctionManager.java, Compiled Code)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.jav
a:737)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:671)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:400)
at testSSL.main(testSSL.java:57)


there is no error reported in error logs of queue manager.


----------------------------------------------------------------------------------
This is my client java code

MQEnvironment.hostname="xx.xx.xx.xx";
MQEnvironment.port=8000;
MQEnvironment.channel="SVRCHNL.SVRCONN";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_CLIENT);
MQEnvironment.sslCipherSuite="SSL_RSA_WITH_RC4_128_MD5";
SSLSocketFactory l_ssl_factory = null;

String p_keystore_type = "jks";
String p_keystore_name = "D:\\jdk1.4.2\\j2sdk1.4.2\\jre\\lib\\security\\cacerts";
String p_keystore_pass = "pass123";
System.setProperty ("javax.net.ssl.keyStore", p_keystore_name);
System.setProperty ("javax.net.ssl.keyStoreType", p_keystore_type);
System.setProperty ("javax.net.ssl.keyStorePassword", p_keystore_pass);
l_ssl_factory = (SSLSocketFactory) SSLSocketFactory.getDefault ();
System.out.println("javax.net.ssl.keyStore :" + System.getProperty("javax.net.ssl.keyStore"));
System.out.println("javax.net.ssl.keyStoreType :" + System.getProperty("javax.net.ssl.keyStoreType"));
System.out.println("javax.net.ssl.keyStorePassword:" + System.getProperty("javax.net.ssl.keyStorePassword"));
MQEnvironment.sslSocketFactory = l_ssl_factory;
// Connection to a Queue Manager
System.out.println("Connecting to a queue manager");
MQPutMessageOptions pmo1 = new MQPutMessageOptions( );
MQQueueManager qm=new MQQueueManager("QMGR");
MQQueue q = new MQQueue (qm, "TEMP.QUEUE", MQC.MQOO_OUTPUT ,"","","");
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
String msgSend="test message";
msg.writeString(msgSend);
q.put(msg,pmo1);
q.close();
qm.close();

Client and MQ servers both are running on Windows machine.

I think the client could not able to locate the keystore but i have given all the classpath required.. but it failed with above error.
I checked with other posts but i could not get the proper solution.

Thanks in advance.

Vedant
Back to top
View user's profile Send private message
vedantpatil
PostPosted: Fri Oct 14, 2005 8:42 am    Post subject: Reply with quote

Novice

Joined: 10 Mar 2005
Posts: 19

I have check this client without SSL. It is working fine.. But with SSL it gives above error.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 14, 2005 8:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I doubt it is the code if it works fine on two machines, but doesn't work on a third.

Is it possible you mangled the certs when you moved them?

Is there something different about the machine that doesn't work from the machine that does work?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vedantpatil
PostPosted: Fri Oct 14, 2005 8:56 am    Post subject: Reply with quote

Novice

Joined: 10 Mar 2005
Posts: 19

I don't think so.. I have copied same certificate file to all the machines.
If we say that code is not able to locate the cacerts file,but the path is hard coded in the code. or is there any possibility that program trying to locate other cacert file?

vedant
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » problem with connecting java client to MQ with SSL
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.