我在将Fiddler作为Java应用的代理时,在使用Java代码连接Fiddler时遇到了SSL证书相关的错误:
liavax.net.ssl. SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building faiat sun. security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun. security.ssl. SSLSocketImpl. fatal(SSLSocketImpl. java:1949)
at sun. security.ssl.Handshaker. fatalSE(Handshaker. java: 302)
at sun. security. ssl. Handshaker.fatalSE(Handshaker. java: 296)
at sun.security.ssl.ClientHandshaker.serverCertificate(clientHandshaker.java:1506)
at sun.security.ssl.clientHandshaker.processMessage(clientHandshaker. java:216)
at sun. security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun. security.ssl.Handshaker.process_record(Handshaker. java:914)
at sun. security.ssl. SSLSocketImpl.readRecord(SSLSocketImpl. java: 1062)
at sun. security. ssl. SSLSocketImpl.performInitialHandshake(SSLSocketImpl. java:1375)
at sun. security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun. security. ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at org. apache.http.conn. ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketat org. apache.http.impl.conn.DefaultHttpclientConnection0perator.upgrade(DefaultHttpclientConiat org. apache.http.impl. conn.PoolingHttpclientConnectionManager.upgrade(PoolingHttpclientConne
解决的办法:
从localhost:8888打开Fiddler Echo Service,点击FiddlerRoot certificate,将安全证书下载到本地,
然后用软件Portecle打开JDK的cacerts证书库,将Fiddler的证书导入即可。
当然不使用Portecle,直接用命令行也是可以的。导入之后,Java应用发送的请求,就能成功被Fiddler接收到了。
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
网友评论