I studied java a long time ago, I stopped for years and now I missed it, I decided to take some scrap video lessons on youtube but I can not access sites that use ssl, the rest of the java normally accesses and returns what I ask , but even had to access the ssl. I already went to the site, I saved the certificate, add to the cacerts, I confirmed it when I opened it and it is still there and I still receive the exception, I already did everything I can think and search and I could not solve it, / p>
public static void main(String[] args) throws IOException {
final Document document = Jsoup.connect("https://www.imdb.com/chart/top")
.userAgent("Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Mobile Safari/537.36")
.timeout(3000)
.cookie("auth", "token")
.referrer("http://www.google.com")
.ignoreHttpErrors(true)
.get();
System.out.println(document.outerHtml());
I always take these exceptions:
xception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:746)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:722)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:306)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:295)
at de.mph_web.imdb_scraper.scraper.main(scraper.java:45)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild (Unknown Source) at sun.security.validator.PKIXValidator.engineValidate (Unknown Source) at sun.security.validator.Validator.validate (Unknown Source) at sun.security.ssl.X509TrustManagerImpl.validate (Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkTrusted (Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted (Unknown Source) ... more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.build (Unknown Source) at sun.security.provider.certpath.SunCertPathBuilder.engineBuild (Unknown Source) at java.security.cert.CertPathBuilder.build (Unknown Source) ... 22 more