gpt4 book ai didi

java - SSLContext.getInstance 中的 NoSuchAlgorithmException

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:10:37 27 4
gpt4 key购买 nike

我在以下代码中得到 NoSuchAlgorithmException:

 @RunWith(PowerMockRunner.class)
@PrepareForTest({CloudWatchHelper.class})
class MyTest {
....
final SSLContext sslcontext = SSLContext.getInstance("TLS");
...
}

堆栈跟踪:

[junit] class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext
[junit] java.security.NoSuchAlgorithmException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext
[junit] at sun.security.jca.GetInstance.checkSuperClass(GetInstance.java:260)
[junit] at sun.security.jca.GetInstance.getInstance(GetInstance.java:237)
[junit] at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
[junit] at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)

我想知道NoSuchAlgorithmException背后的原因是什么。

最佳答案

在我的测试类中添加以下注释为我解决了这个问题:

@PowerMockIgnore({ "javax.net.ssl.*", "javax.security.*" })

关于java - SSLContext.getInstance 中的 NoSuchAlgorithmException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45859482/

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