0

我的 spring-boot 项目中的一个特定依赖项存在一些问题。我正在使用 netty-tcnative-boringssl-static 并将我的 spring-boot 版本从 2.0.5 升级到 2.1.3,现在我收到以下我无法破译的错误消息:

***************************
APPLICATION FAILED TO START
***************************

Description:
An attempt was made to call the method io.netty.internal.tcnative.SSLContext.setCipherSuite(JLjava/lang/String;Z)Z but it does not exist. Its class, io.netty.internal.tcnative.SSLContext, is available from the following locations:

    jar:file:/C:/Users/xxx/.m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.12.Final/netty-tcnative-boringssl-static-2.0.12.Final.jar!/io/netty/internal/tcnative/SSLContext.class

It was loaded from the following location:

    file:/C:/Users/xxx/.m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.12.Final/netty-tcnative-boringssl-static-2.0.12.Final.jar


Action:
Correct the classpath of your application so that it contains a single, compatible version of io.netty.internal.tcnative.SSLContext

我不完全理解此错误消息,说明的路径是相同的,在我的类路径上我可以找到具有请求方法的库。

我认为可能是由于某种原因 netty-tcnative-boringssl-static 与 spring-boot >2.1.0 不兼容。错误消息中的方法签名让我感到困惑。

setCipherSuite(JLjava/lang/String;Z)Zjava代码中会是什么样子?我有权访问的方法具有此签名public static boolean setCipherSuite(long ctx, String ciphers)

我不确定这是否是真正的不匹配,如果不是,那么我没有想法,如果是,那么我可以通过摆弄不同的版本来解决它。

有人知道吗?

4

1 回答 1

1

您可以查看 JVM 规范:jvms-4.3.2进行转换。

在此处输入图像描述

因此,在您的情况下,(JLjava/lang/String;Z)Z 将转换为具有 long( J)、String( Ljava/lang/String;)、boolean( Z) 且返回类型为 boolean( Z) 的方法。

检查 netty-tcnative 的主分支,我可以看到 2 种方法,setCipherSuite(..)其中一种方法被弃用

@Deprecated
    public static boolean setCipherSuite(long ctx, String ciphers) throws Exception {
        return setCipherSuite(ctx, ciphers, false);
    }

    public static native boolean setCipherSuite(long ctx, String ciphers, boolean tlsv13) throws Exception; 
于 2019-05-09T07:02:51.913 回答