Can you please help me, I am trying to find the ibm mq depth with PCFAgent over SSL channel.
Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
Security.setProperty("ssl.ServerSocketFactory.provider", "com.ibm.jsse2.SSLServerSocketFactoryImpl");
System.setProperty("javax.net.ssl.trustStore","abc-dev.jks");
System.setProperty("javax.net.ssl.trustStorePassword","abcdabcd");
System.setProperty("javax.net.ssl.keyStore", "abc-dev.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "abcdabcd");
MQEnvironment.sslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA";
int attrs[] = { 2016, 3 };
System.out.println("parameter creation");
PCFParameter parameters[] = { new MQCFST(2016, "*"), new MQCFIN(20, 1),
new MQCFIL(1002, attrs) };
String name = null;
Integer depth = null;
System.out.println("parameter creation end");
try {
PCFAgent agent;
if (args.length == 1) {
System.out.print("Connecting to local queue manager " + args[0]
+ "... ");
agent = new PCFAgent(args[0]);
} else {
System.out.print("Connecting to queue manager at " + args[0]
+ ":" + args[1] + " over channel " + args[2] + "... ");
agent = new PCFAgent(args[0], Integer.parseInt(args[1]),
args[2]);
}
System.out.println("Connected.");
System.out.print("Sending PCF request... ");
com.ibm.mq.MQMessage responses[] = agent.send(13, parameters);
System.out.println("Received reply.");
for (int i = 0; i < responses.length; i++) {
MQCFH cfh = new MQCFH(responses[i]);
if (cfh.reason == 0) {
for (int j = 0; j < cfh.parameterCount; j++) {
PCFParameter p = PCFParameter
.nextParameter(responses[i]);
switch (p.getParameter()) {
case 2016:
name = (String) p.getValue();
break;
case 3: // '\003'
depth = (Integer) p.getValue();
break;
}
}
System.out.println("Queue " + name + " curdepth " + depth);
} else {
System.out.println("PCF error:\n" + cfh);
for (int j = 0; j < cfh.parameterCount; j++)
System.out.println(PCFParameter
.nextParameter(responses[0]));
}
}
System.out.print("Disconnecting... ");
agent.disconnect();
System.out.println("Done.");
} catch (ArrayIndexOutOfBoundsException abe) {
System.out
.println("Usage: \n\tjava ListQueueDepth queue-manager\n\tjava ListQueueDepth host port channel");
} catch (NumberFormatException nfe) {
System.out.println("Invalid port: " + args[1]);
System.out
.println("Usage: \n\tjava ListQueueDepth queue-manager\n\tjava ListQueueDepth host port channel");
} catch (MQException mqe) {
System.err.println(mqe);
} catch (IOException ioe) {
System.err.println(ioe);
}
When I try run this program remotely, I am getting the following exception:
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2035
EDIT to add additional clarifying details from the comments:
The MQ Admin found an error in the AMQERR01.LOG
related to the SYSTEM.DEFAULT.MODEL.QUEUE at the same time the application receives the 2035.
The same program works for a non-SSL channel when I take off the security settings and ciphersuite.