1
votes

I am facing a strange problem with IBM MQ 8.0.0.4. My command line application (Java 8) connects to MQ server installed in linux server from windows environment. The application reads messages from a particular queue as it arrives. I use following jars as client library (8.0.0.4-WS-MQ-Install-Java-All.jar):-

com.ibm.mq.allclient.jar
com.ibm.mq.traceControl.jar
fscontext.jar
jms.jar
JSON4J.jar
providerutil.jar

The application runs as usual without any problem. It can be stopped by "control+c". When that is done, ThreadGroup.interrupt() is called and the application stops as expected. What is not expected is:-

1) the following stack trace

[2016-05-26 14:13:14,023]-[DEBUG]-[       Thread-7]-[com.xyz.app.inf.DecoratorBase.invoke(){106}]-not overridden
[2016-05-26 14:13:14,316]-[ERROR]-[       Thread-7]-[com.xyz.app.inf.console.launcher.ServiceRunnerBase.serviceInternal(){230}]-Unhanled exception
com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2002: Failed to get a message from destination 'QNAME'.
WebSphere MQ classes for JMS attempted to perform an MQGET; however WebSphere MQ reported an error.
Use the linked exception to determine the cause of this error.
    at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)
    at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:213)
    at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:261)
    at com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1835)
    at com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:231)
    at com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:1471)
    at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:659)
    at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:1036)
    at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:671)
    at com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:209)
    at com.xyz.app.inf.XQueueReceiver.receive(XQueueReceiver.java:141)
    at com.xyz.app.inf.XQueueReceiver.receive(XQueueReceiver.java:100)
    at com.xyz.app.cli.services.impl.MessageRunner.read(MessageRunner.java:440)
    at com.xyz.app.cli.services.impl.MessageRunner.task(MessageRunner.java:201)
    at com.xyz.app.inf.console.launcher.ServiceRunnerBase.serviceInternal(ServiceRunnerBase.java:227)
    at com.xyz.app.inf.console.launcher.ServiceRunnerBase.run(ServiceRunnerBase.java:127)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2195' ('MQRC_UNEXPECTED_ERROR').
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
    ... 16 more
Caused by: com.ibm.mq.jmqi.local.LocalMQ$4: CC=2;RC=2495;AMQ8598: Failed to load the WebSphere MQ native JNI library: 'mqjbnd'.
    at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1268)
    at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:309)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.mq.jmqi.local.LocalMQ.initialise_inner(LocalMQ.java:259)
    at com.ibm.mq.jmqi.local.LocalMQ.initialise(LocalMQ.java:221)
    at com.ibm.mq.jmqi.local.LocalMQ.<init>(LocalMQ.java:1350)
    at com.ibm.mq.jmqi.local.LocalServer.<init>(LocalServer.java:230)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:706)
    at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:640)
    at com.ibm.msg.client.wmq.factories.WMQComponent.getImplementationInfo(WMQComponent.java:251)
    at com.ibm.msg.client.commonservices.trace.Trace.getVersion(Trace.java:2092)
    at com.ibm.msg.client.commonservices.trace.Trace.createFFSTString(Trace.java:2050)
    at com.ibm.msg.client.commonservices.trace.Trace.ffstInternal(Trace.java:1935)
    at com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1736)
    at com.ibm.mq.jmqi.remote.impl.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2540)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiGetInternalWithRecon(RemoteFAP.java:7169)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiGetInternal(RemoteFAP.java:7054)
    at com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1217)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiGet(RemoteFAP.java:7001)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiGet(InterceptedJmqiImpl.java:1325)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiGet(ESEJMQI.java:600)
    at com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1775)
    ... 13 more
Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1240)
    ... 38 more
[2016-05-26 14:13:14,326]-[INFO ]-[       Thread-5]-[com.xyz.app.startup.Application.destroy(){433}]-Application shutting down
[2016-05-26 14:13:14,326]-[INFO ]-[       Thread-5]-[com.xyz.app.startup.Application.cleanup(){608}]-Application.cleanup() called------ 

2) a folder named FFDC is created which contains files named JMSCC0001.FDC, JMSCC0002.FDC etc.

The reason why I am saying the stack trace is unexpected is it says that "no mqjbnd in java.library.path" which means the application is connecting MQ server in bindings mode. But I am connecting in client mode as you can see:

com.ibm.mq.jms.MQQueueConnectionFactory@c79b6829  :-  
|   |   XMSC_ADMIN_OBJECT_TYPE             :-  17
|   |   XMSC_ASYNC_EXCEPTIONS              :-  1
|   |   XMSC_CLIENT_ID                     :-  <null>
|   |   XMSC_CONNECTION_TYPE               :-  1
|   |   XMSC_CONNECTION_TYPE_NAME          :-  com.ibm.msg.client.wmq
|   |   XMSC_RTT_DIRECT_AUTH               :-  0
|   |   XMSC_RTT_PROXY_HOSTNAME            :-  <null>
|   |   XMSC_RTT_PROXY_PORT                :-  443
|   |   XMSC_WMQ_BROKER_CC_SUBQ            :-  SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE
|   |   XMSC_WMQ_BROKER_CONTROLQ           :-  SYSTEM.BROKER.CONTROL.QUEUE
|   |   XMSC_WMQ_BROKER_PUBQ               :-  SYSTEM.BROKER.DEFAULT.STREAM
|   |   XMSC_WMQ_BROKER_QMGR               :-  
|   |   XMSC_WMQ_BROKER_SUBQ               :-  SYSTEM.JMS.ND.SUBSCRIBER.QUEUE
|   |   XMSC_WMQ_CCDTURL                   :-  <null>
|   |   XMSC_WMQ_CF_DESCRIPTION            :-  <null>
|   |   XMSC_WMQ_CHANNEL                   :-  NSICHL
|   |   XMSC_WMQ_CLEANUP_INTERVAL          :-  3600000
|   |   XMSC_WMQ_CLEANUP_LEVEL             :-  1
|   |   XMSC_WMQ_CLIENT_RECONNECT_OPTIONS  :-  0
|   |   XMSC_WMQ_CLIENT_RECONNECT_TIMEOUT  :-  1800
|   |   XMSC_WMQ_CLONE_SUPPORT             :-  0
|   |   XMSC_WMQ_CONNECTION_MODE           :-  1
|   |   XMSC_WMQ_CONNECTION_NAME_LIST_INT  :-  
|   |   |   0  :-  172.16.31.29(1414)
|   |   XMSC_WMQ_CONNECTION_TAG            :-  [B@161c410
|   |   XMSC_WMQ_CONNECT_OPTIONS           :-  0
|   |   XMSC_WMQ_HEADER_COMP               :-  
|   |   |   0  :-  0
|   |   XMSC_WMQ_LOCAL_ADDRESS             :-  
|   |   XMSC_WMQ_MAP_NAME_STYLE            :-  true
|   |   XMSC_WMQ_MAX_BUFFER_SIZE           :-  1000
|   |   XMSC_WMQ_MESSAGE_RETENTION         :-  1
|   |   XMSC_WMQ_MESSAGE_SELECTION         :-  0
|   |   XMSC_WMQ_MSG_BATCH_SIZE            :-  10
|   |   XMSC_WMQ_MSG_COMP                  :-  
|   |   |   0  :-  0
|   |   XMSC_WMQ_OPT_PUB                   :-  false
|   |   XMSC_WMQ_OUTCOME_NOTIFICATION      :-  true
|   |   XMSC_WMQ_POLLING_INTERVAL          :-  5000
|   |   XMSC_WMQ_PROCESS_DURATION          :-  0
|   |   XMSC_WMQ_PROVIDER_VERSION          :-  unspecified
|   |   XMSC_WMQ_PUB_ACK_INTERVAL          :-  25
|   |   XMSC_WMQ_QMGR_CCSID                :-  819
|   |   XMSC_WMQ_QUEUE_MANAGER             :-  NSI
|   |   XMSC_WMQ_RECEIVE_EXIT              :-  <null>
|   |   XMSC_WMQ_RECEIVE_EXIT_INIT         :-  <null>
|   |   XMSC_WMQ_RECEIVE_ISOLATION         :-  0
|   |   XMSC_WMQ_RESCAN_INTERVAL           :-  5000
|   |   XMSC_WMQ_SECURITY_EXIT             :-  <null>
|   |   XMSC_WMQ_SECURITY_EXIT_INIT        :-  <null>
|   |   XMSC_WMQ_SEND_CHECK_COUNT          :-  0
|   |   XMSC_WMQ_SEND_EXIT                 :-  <null>
|   |   XMSC_WMQ_SEND_EXIT_INIT            :-  <null>
|   |   XMSC_WMQ_SHARE_CONV_ALLOWED        :-  1
|   |   XMSC_WMQ_SPARSE_SUBSCRIPTIONS      :-  false
|   |   XMSC_WMQ_SSL_CERT_STORES_COL       :-  <null>
|   |   XMSC_WMQ_SSL_CERT_STORES_STR       :-  <null>
|   |   XMSC_WMQ_SSL_CIPHER_SUITE          :-  <null>
|   |   XMSC_WMQ_SSL_FIPS_REQUIRED         :-  false
|   |   XMSC_WMQ_SSL_KEY_RESETCOUNT        :-  0
|   |   XMSC_WMQ_SSL_PEER_NAME             :-  <null>
|   |   XMSC_WMQ_SSL_SOCKET_FACTORY        :-  <null>
|   |   XMSC_WMQ_STATUS_REFRESH_INTERVAL   :-  60000
|   |   XMSC_WMQ_SUBSCRIPTION_STORE        :-  1
|   |   XMSC_WMQ_SYNCPOINT_ALL_GETS        :-  false
|   |   XMSC_WMQ_TARGET_CLIENT_MATCHING    :-  true
|   |   XMSC_WMQ_TEMPORARY_MODEL           :-  SYSTEM.DEFAULT.MODEL.QUEUE
|   |   XMSC_WMQ_TEMP_Q_PREFIX             :-  
|   |   XMSC_WMQ_TEMP_TOPIC_PREFIX         :-  
|   |   XMSC_WMQ_USE_CONNECTION_POOLING    :-  true
|   |   brokerVersion                      :-  -1
|   |   failIfQuiesce                      :-  1
|   |   multicast                          :-  0
|   |   version                            :-  7
|   |   wildcardFormat                     :-  0

The above stack trace is not encountered when I use the client library belonging to Websphere MQ 7.0. Please help.

3

3 Answers

1
votes

The fact that you have an MQRC_UNEXPECTED_ERROR and FDC files means you should really open a PMR with IBM for this one. This is not meant to happen.

0
votes

The application runs as usual without any problem. It can be stopped by "control+c". When that is done, ThreadGroup.interrupt() is called and the application stops as expected.

So your application was in the middle of an MQGET and then you crashed it and then you wonder why you get weird results!!

The code needs to wait for the MQGET API to complete then your application needs to close the queue and disconnect from the queue manager.

0
votes

This issue was fixed with APAR IT16294: Incorrect error about JNI library 'mqjbnd' when connecting to queue manager in client transport

Problem conclusion

The MQ classes for JMS have been updated to ensure that any internal exceptions that occur while generating an FDC are not added as the cause for any MQExceptions which are themselves the cause for JMSExceptions thrown back to applications. As a result of these changes, the internal exception:

com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. For a client installation this is expected.

is no longer added as the cause for the MQException containing MQ Reason Code 2195, which is the cause of the JMSException thrown if an application interrupts a thread while it is calling one of the methods shown below:

  • MessageConsumer.receive()
  • MessageConsumer.receive(long timeout)
  • MessageConsumer.receiveNoWait()

This is fixed in the following versions and later:

The fix is targeted for delivery in the following PTFs:

Version    Maintenance Level
v8.0       8.0.0.7
v9.0 CD    9.0.2
v9.0 LTS   9.0.0.1