gpt4 book ai didi

Grails:Groovy:SSLPeerUnverifiedException: 对等方未通过身份验证

转载 作者:行者123 更新时间:2023-12-04 14:58:39 25 4
gpt4 key购买 nike

我想在本地系统中运行代码时向 url 发出 xml 请求它运行良好我已经创建了一个 war 文件并将其部署在服务器中,但是在服务器中运行时出现异常 'javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated'我使用了 groovy http builder

def http = new HTTPBuilder(url)
http.auth.basic('username', 'password')
try {
http.request(Method.POST, ContentType.TEXT) {
req->
headers.accept = "application/xml"
body = request //xml request
response.success = {
resp,reader ->
Response = reader.text
}
}
}
catch(HttpResponseException ex) {
println ex;
}

在这种情况下我该如何解决这个问题..?

最佳答案

解决方法:以下答案提供了解决此问题的方法:https://stackoverflow.com/a/25076888/782034

Just found out that new version (0.7.1) of HttpBuilder introduces method:

ignoreSSLIssues()

This solves all problems regarding invalid SSL certificates (of course you have to be aware that it also decrease security).

More information about this method: http://groovy.codehaus.org/modules/http-builder/doc/ssl.html (section at the bottom)



IE。
def http = new HTTPBuilder(url)
http.ignoreSSLIssues()

解决方案:如果您想以“正确”的方式做事,请查看有关导入服务器证书的其他解决方案。例如 SSLPeerUnverifiedException: peer not authenticated

关于Grails:Groovy:SSLPeerUnverifiedException: 对等方未通过身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23692780/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com