0

i also want to know how to ignore SSL certificate errors in Apache HttpClient 4.0 ,so i read this post:How to ignore SSL certificate errors in Apache HttpClient 4.0 and do as it say.

but i got an error in intellij idea in this statement:

   SSLContext sslContext = SSLContext.getInstance("SSL");

Unhandle exception:java.security.NoSuchAlgorithmException.

i also tried "TLS" but useless.

Please does anybody know how to solve this issue?

1 Answer 1

2

You get this compile error because SSLContext.getInstance("SSL"); throws a checked exception which you have to take care of.

Either by surrounding the line with a try-catch block:

try {
   SSLContext sslContext = SSLContext.getInstance("SSL");
} catch (NoSuchAlgorithmException e) {
   /// handle e
}

or add throws NoSuchAlgorithmException to the method definition.

This are Java basics you should learn something about Exceptions: Lesson: Exceptions

Sign up to request clarification or add additional context in comments.

1 Comment

hank you for actually helping me ^.^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.