ibm-messaging / mq-jms-spring

Components to assist MQ JMS integration with Spring frameworks
Apache License 2.0
186 stars 102 forks source link

If 'org.springframework.jms' loggers are set to debug level, the MQ client crashes #90

Closed pauljohe-dnb closed 1 year ago

pauljohe-dnb commented 1 year ago

Using JmsTemplate with something like this in the logging setup cause the IBM MQ driver to crash:

<logger name="org.springframework" level="debug"/>:

java.lang.AssertionError
    at com.ibm.msg.client.wmq.common.internal.WMQPropertyContext.getStringProperty(WMQPropertyContext.java:390)
    at com.ibm.msg.client.wmq.common.internal.StringableProperty.resolve(StringableProperty.java:137)
    at com.ibm.msg.client.wmq.common.internal.StringableProperty.jsonIfy(StringableProperty.java:129)
    at com.ibm.msg.client.wmq.internal.WMQSession.toJson(WMQSession.java:2162)
    at com.ibm.msg.client.jms.internal.JmsSessionImpl.toJson(JmsSessionImpl.java:6097)
    at com.ibm.mq.jms.MQSession.toString(MQSession.java:1476)
    at org.messaginghub.pooled.jms.pool.PooledSessionHolder.toString(PooledSessionHolder.java:268)
    at java.base/java.lang.String.valueOf(String.java:4218)
    at java.base/java.lang.StringBuilder.append(StringBuilder.java:173)
    at org.messaginghub.pooled.jms.JmsPoolSession.toString(JmsPoolSession.java:473)
    at java.base/java.lang.String.valueOf(String.java:4218)
    at java.base/java.lang.StringBuilder.append(StringBuilder.java:173)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:502)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584)

Here is the Spring framework code from the above stack:

if (logger.isDebugEnabled()) {
     logger.debug("Executing callback on JMS Session: " + sessionToUse); // <-- fails here
}

Upon further debugging, the 'jsonIfy' method tries to read 'XMSC_WMQ_HOST_NAME' and 'XMSC_WMQ_PORT' as strings so the initialization crashes on an assert in the code which does not allow reading these properties as strings.

The spring boot config is using the default values and is trying to connect to a local docker container with the correct setup.

If the logger is set to info level, everything works correctly.

ibmmqmet commented 1 year ago

Looks like known problem with planned fix: https://www.ibm.com/support/pages/apar/IT42506 Not something that can be handled by this repo as it's in the underlying MQ classes.

pauljohe-dnb commented 1 year ago

Thanks for info!

I guess this issue can be marked as completed as soon as it points to the updated transitive dependency with the fix. 👍

ibmmqmet commented 1 year ago

The fix is meant to be available in MQ 9.3.2 which is referenced from current versions of this Spring package