java - IBM MQ 在 SSL 握手时抛出 java.lang.UnsupportedOperationException

标签 java ssl jms ibm-mq

调用时:

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 开始。

最佳答案

关于java - IBM MQ 在 SSL 握手时抛出 java.lang.UnsupportedOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64057285/

相关文章:

java - 打乱排序的数组

java - Tomcat trowing 无效的生命周期转换

Java:使用 OutputStreamWriter 将值传递到 jar

ssl - 当我尝试启动 ProFTPD 服务器时 Webmin 发送 fatal error

c - 如何使用 API 并正确初始化 openssl?

.net - 无法使用 HttpRequest 创建 SSL/TLS 安全通道

java - 注解@ActivationConfigProperty支持的属性的完整列表是什么

java - 消息传递(例如 JMS)何时可以替代多线程?

JMSExpiration 与 TimeToLive

java - 在 Java 8 中,为什么没有给数组提供 Iterable 的 forEach 方法?