The exception is not related to HTTP Basic Authentication, i.e., is not about missing authentication credentials. This also has nothing to do with broken links. This bizzarre exception message is saying that in your truststore you do not have certificate of the Web site you want to connect to, so simply that you do not trust this site.
Now the solution depends on which of your code excerpts we're talking about. For the first you should use HttpsURLConnection
instead of HttpURLConnection
, because you're trying to connect to SSL-protected URL. Then you should:
- download site's certificate and add it to your local trusstore, or
- use trust manager that does not validate certificate chains for SSL socketsuse trust manager that does not validate certificate chains for SSL sockets.
For the second code which uses WebDriver it may depend on which library version are usingwhich library version are using. So which one are you using?