ibm-messaging / mq-jms-spring

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

Deprecated method exception when using spring boot 2 and java 17 #98

Closed sw-tracker closed 5 months ago

sw-tracker commented 11 months ago

Description

We are currently using spring boot 2.7.3 with java 17, and we keep getting the exception that a method is deprecated. We found a stackoverflow issue saying that it is due to using an older MQ library with java 17. How can we fix this issue? What version of your mq-jms-spring-boot-starter should we be using?

Versions

-> java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)

-> mvn -version
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /usr/share/maven
Java version: 17.0.7, vendor: Eclipse Adoptium, runtime: /opt/java/openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-1035-azure", arch: "amd64", family: "unix"
<!--    springboot version-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

<!--    MQ library version-->
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>mq-jms-spring-boot-starter</artifactId>
        <version>2.7.14</version>
    </dependency>
# MQ Version
Name: IBM MQ
Version: 9.3.0.5
Level: p930-005-230413
BuildType: IKAP - (Production)
Platform: IBM MQ for Linux (x86-64 platform)
Mode: 64-bit
O/S: Linux 3.10.0-1160.92.1.el7.x86_64
O/S Details: Red Hat Enterprise Linux Server 7.9 (Maipo)

Error

Exception in thread "HandshakeCompletedNotify-Thread" java.lang.UnsupportedOperationException: This method is deprecated and marked for removal. Use the getPeerCertificates() method instead.
 at java.base/javax.net.ssl.SSLSession.getPeerCertificateChain(SSLSession.java:295)
 at java.base/javax.net.ssl.HandshakeCompletedEvent.getPeerCertificateChain(HandshakeCompletedEvent.java:173)
 at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.handshakeCompleted(RemoteTCPConnection.java:2501)
 at java.base/sun.security.ssl.TransportContext$NotifyHandshake$1.run(TransportContext.java:694)
 at java.base/sun.security.ssl.TransportContext$NotifyHandshake$1.run(TransportContext.java:691)
 at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
 at java.base/sun.security.ssl.TransportContext$NotifyHandshake.run(TransportContext.java:691)
 at java.base/java.lang.Thread.run(Thread.java:833)
ibmmqmet commented 11 months ago

That's not really a matter for this starter package. The question ought to be which version of the MQ JMS classes got rid of that deprecated call. As best I can tell, it was in MQ 9.2.5 or 9.3.0 that support for Java 17 was claimed.

And the MQ 9.3.0.0 level was picked up as the dependency in mq-jms-spring-boot-starter:2.7.1. So you need to check which version of the JMS client is actually being pulled in.