0

I encounter a problem when I want to use HtmlUnit (version 2.10) with an https website.

I have initialize an WebClient Object and I have specify some parameters.

webClient.setSSLClientCertificate(URL,PASSWORD,"pkcs12");
webClient.setUseInsecureSSL(true);

The setUseInsecureSSL method throws an IllegalArgumentException with this message : "Socket factory may not be null"

Stack trace

org.apache.http.conn.scheme.Scheme.(Scheme.java:94) com.gargoylesoftware.htmlunit.HttpWebConnection.createHttpClient(HttpWebConnection.java:535) com.gargoylesoftware.htmlunit.HttpWebConnection.getHttpClient(HttpWebConnection.java:500) com.gargoylesoftware.htmlunit.HttpWebConnection.setUseInsecureSSL(HttpWebConnection.java:711) com.gargoylesoftware.htmlunit.WebClient.setUseInsecureSSL(WebClient.java:1096) mon.package.HtmlUnitAbstract.setSSLClientCertificate(HtmlUnitAbstract.java:66)

Someone already had this type of error ? Thanks for your help.

0

1 Answer 1

4

Avoid using deprecated methods, try the code below instead:

webClient.getOptions().setSSLClientCertificate(URL,PASSWORD,"pkcs12");
webClient.getOptions().setUseInsecureSSL(true);
Sign up to request clarification or add additional context in comments.

Comments

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.