无法在 HttpBuilder 版本 0.7.1 中使用 ignoreSSLIssues
Can't use ignoreSSLIssues in HttpBuilder version 0.7.1
Java 8 |
Groovy 语言 |
IDE:IntelliJ IDEA |
Gradle3
我遇到 SSL 问题
代码:
import groovyx.net.http.RESTClient
def client = new RESTClient()
client.ignoreSSLIssues()
def result = client.get(uri: "https://sacvo76l6b.execute-api.ap-northeast-
1.amazonaws.com/")
抛出以下异常
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:431)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:572)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1066)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1044)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
at groovyx.net.http.RESTClient.get(RESTClient.java:119)
at Test.getAuthCode_(Test.groovy:53)
虽然我正在使用 ignoreSSLIssues()
,但它似乎不适合我。
我也下载了0.7.2版本来验证这个问题,也是同样的问题
PS1:如果我使用 Postman,Uri 对我来说工作正常
PS2:HttpURLConnection 库也适用于我
你有什么想法吗?非常感谢
解决"javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated"问题
我只是将最新版本的 httpclient 导入 Gradle/Maven
compile 'org.apache.httpcomponents:httpclient:4.5.3'
我花了2天时间才解决。我希望这对像我这样的人有所帮助。
Java 8 |
Groovy 语言 |
IDE:IntelliJ IDEA |
Gradle3
我遇到 SSL 问题
代码:
import groovyx.net.http.RESTClient
def client = new RESTClient()
client.ignoreSSLIssues()
def result = client.get(uri: "https://sacvo76l6b.execute-api.ap-northeast-
1.amazonaws.com/")
抛出以下异常
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:431) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:572) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1066) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1044) at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515) at groovyx.net.http.RESTClient.get(RESTClient.java:119) at Test.getAuthCode_(Test.groovy:53)
虽然我正在使用 ignoreSSLIssues()
,但它似乎不适合我。
我也下载了0.7.2版本来验证这个问题,也是同样的问题
PS1:如果我使用 Postman,Uri 对我来说工作正常
PS2:HttpURLConnection 库也适用于我
你有什么想法吗?非常感谢
解决"javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated"问题 我只是将最新版本的 httpclient 导入 Gradle/Maven
compile 'org.apache.httpcomponents:httpclient:4.5.3'
我花了2天时间才解决。我希望这对像我这样的人有所帮助。