webmagic javax.net.ssl.SSLPeerUnverifiedException

阅读更多

 17-04-21 15:10:46,496 INFO  us.codecraft.webmagic.Spider(Spider.java:306) ## Spider hz.daoxila.com started!

17-04-21 15:10:47,511 WARN  us.codecraft.webmagic.downloader.HttpClientDownloader(HttpClientDownloader.java:92) ## download page https://hz.daoxila.com/HunYan/ error

javax.net.ssl.SSLPeerUnverifiedException: Host name 'hz.daoxila.com' does not match the certificate subject provided by the peer (CN=*.ucdl.pp.uc.cn, OU=IT DEPT, O=广州市动景计算机科技有限公司, L=Guangzhou, ST=Guangdong, C=CN)

at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465)

at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)

at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)

at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)

at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)

at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)

at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)

at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)

at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)

at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)

at us.codecraft.webmagic.downloader.HttpClientDownloader.download(HttpClientDownloader.java:86)

at us.codecraft.webmagic.Spider.processRequest(Spider.java:403)

at us.codecraft.webmagic.Spider.access$2(Spider.java:402)

at us.codecraft.webmagic.Spider$1.run(Spider.java:320)

at us.codecraft.webmagic.thread.CountableThreadPool$1.run(CountableThreadPool.java:74)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

 

原因:

查看网站证书的安全协议TLS v1.2,

TLS v1.2 wasn't implemented until java 7. Try upgrading your Java version or if you're stuck in java 5 or 6 and REALLY need to use TLS v1.2 try using BouncyCastle: https://goo.gl/Tg3jd0

webmagic maven功能默认是jdk1.6. 部分https的网站会有问题,解决方法,更改成1.7

 

你可能感兴趣的:(webmagic,https)