gpt4 book ai didi

java - 为什么 Maven 提示 netty-tcnative-boringssl-static 中据称缺少方法?

转载 作者:行者123 更新时间:2023-12-02 09:55:17 26 4
gpt4 key购买 nike

我的 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)Z 在 Java 代码中会是什么样子?我有权访问的方法具有此签名public static boolean setCipherSuite(long ctx, String ciphers)

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

有人有什么想法吗?

最佳答案

您可以查看 JVM 规范:jvms-4.3.2用于转换。

enter image description here

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

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

@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;

关于java - 为什么 Maven 提示 netty-tcnative-boringssl-static 中据称缺少方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56043488/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com