Monday, July 16, 2018

PowerMockito: java.security.NoSuchAlgorithmException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext

Problem

Following exception is encountered while running a JUnit test written using PowerMockito.
org.apache.http.ssl.SSLInitializationException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$\$$TLSContext not a SSLContext
at org.apache.http.ssl.SSLContexts.createDefault(SSLContexts.java:55)
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:964)
.................
.................

Caused by: java.security.NoSuchAlgorithmException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$\$$TLSContext not a SSLContext
.................
.................

Solution

This can be fixed by adding following annotation to the test class.

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








2 comments: