MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

SSL ? #221

Closed donaldlee2008 closed 7 years ago

donaldlee2008 commented 7 years ago

Builder BB2=new Builder (); BB2.ssl("compatible"); Settings ss2=BB2.build(); JBrowserDriver driver2 = new JBrowserDriver(ss2); JBrowserDriver driver2 = new JBrowserDriver(ss2); driver2.get("https://frontier.xian.95306.cn/gateway/hydzsw/Dzsw/login_bur.jsp");

how to fix it ? [2016-11-30T14:44:09.240][Instance 1][Port 57645] ʮһ�� 30, 2016 10:44:09 ���� com.sun.webkit.network.URLLoader doRun [2016-11-30T14:44:09.241][Instance 1][Port 57645] ����: Unexpected error [2016-11-30T14:44:09.241][Instance 1][Port 57645] java.io.IOException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target: https://frontier.xian.95306.cn/gateway/hydzsw/Dzsw/login_bur.jsp [2016-11-30T14:44:09.241][Instance 1][Port 57645] at com.machinepublishers.jbrowserdriver.StreamConnection.exec(StreamConnection.java:373) [2016-11-30T14:44:09.241][Instance 1][Port 57645] at com.machinepublishers.jbrowserdriver.StreamConnection.getResponseCode(StreamConnection.java:471) [2016-11-30T14:44:09.241][Instance 1][Port 57645] at com.sun.webkit.network.URLLoader.receiveResponse(URLLoader.java:420) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:164) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at com.sun.webkit.network.URLLoader.lambda$run$94(URLLoader.java:129) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at java.security.AccessController.doPrivileged(Native Method) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at com.sun.webkit.network.URLLoader.run(URLLoader.java:128) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at java.util.concurrent.FutureTask.run(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at java.lang.Thread.run(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] Caused by: 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 [2016-11-30T14:44:09.242][Instance 1][Port 57645] at sun.security.ssl.Alerts.getSSLException(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) [2016-11-30T14:44:09.242][Instance 1][Port 57645] at sun.security.ssl.Handshaker.fatalSE(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.Handshaker.fatalSE(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.Handshaker.processLoop(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.Handshaker.process_record(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) [2016-11-30T14:44:09.243][Instance 1][Port 57645] at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at com.machinepublishers.jbrowserdriver.StreamConnectionClient.execute(StreamConnectionClient.java:168) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at com.machinepublishers.jbrowserdriver.StreamConnection.exec(StreamConnection.java:339) [2016-11-30T14:44:09.244][Instance 1][Port 57645] ... 11 more [2016-11-30T14:44:09.244][Instance 1][Port 57645] Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [2016-11-30T14:44:09.244][Instance 1][Port 57645] at sun.security.validator.PKIXValidator.doBuild(Unknown Source) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) [2016-11-30T14:44:09.244][Instance 1][Port 57645] at sun.security.validator.Validator.validate(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] ... 30 more [2016-11-30T14:44:09.245][Instance 1][Port 57645] Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [2016-11-30T14:44:09.245][Instance 1][Port 57645] at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] at java.security.cert.CertPathBuilder.build(Unknown Source) [2016-11-30T14:44:09.245][Instance 1][Port 57645] ... 36 more [2016-11-30T14:44:09.245][Instance 1][Port 57645]

hollingsworthd commented 7 years ago

That CA isn't in the trust store. You could disable ssl "trustanything" instead of "compatible". Or you can fall back to the JRE CA store and import this one manually.

hollingsworthd commented 7 years ago

Actually that doesn't disable SSL but makes every CA a trusted one.