2017-08-24 72 views
0

我越來越NoSuchAlgorithmException下面的代碼:拋出:NoSuchAlgorithmException在SSLContext.getInstance

@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的原因。

+0

你搞砸了你的security.providers文件。 – EJP

+0

你使用了什麼JRE?什麼-Djavax.net.debug =都提供了什麼? – siom

+0

@siom Java™SE運行時環境(內部版本1.8.0_144-b01) – doptimusprime

回答

-1

我意識到,我是因爲異常:

@RunWith(PowerMockRunner.class) 
@PrepareForTest({CloudWatchHelper.class}) 
相關問題