调用时:
MQQueueConnectionFactory cf ...
cf.createConnection();
com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.handshakeCompleted方法开始:
public void handshakeCompleted(HandshakeCompletedEvent event) {
X509Certificate[] peerCertificateChain = event.getPeerCertificateChain();
...
Javax.net.ssl.SSLSession中的getPeerCertificateChain:
default X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException {
throw new UnsupportedOperationException("This method is deprecated and marked for removal. Use the getPeerCertificates() method instead.");
}
导致此异常的原因:
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:2448)
at java.base/sun.security.ssl.TransportContext$NotifyHandshake$1.run(TransportContext.java:685)
at java.base/sun.security.ssl.TransportContext$NotifyHandshake$1.run(TransportContext.java:682)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/sun.security.ssl.TransportContext$NotifyHandshake.run(TransportContext.java:682)
at java.base/java.lang.Thread.run(Thread.java:832)
该项目唯一的IBM MQ依赖项是:
com.ibm.mq:com.ibm.mq.allclient:9.2.0.0
为什么javax.net.ssl.getPeerCertificateChain()调用那个被弃用的方法?看起来问题出在HandshakeCompletedEvent类中,而不是MQ中。
编辑:这个问题从Java 15开始。
发布于 2021-11-30 11:34:53
IBM MQ client 9.2.4.0支持Java 17
https://www.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/8/899/ENUSLP21-0278/index.html
MQ 9.2.4
支持™17 runtimes
IBM客户端的
Java17支持
如果使用maven,您可能可以通过
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId>
<version>9.2.4.0</version>
</dependency>
https://stackoverflow.com/questions/64057285
复制相似问题