问题描述
我正在使用Jersey-client-2.27,通过它调用https来获得呼叫,如下所示:
Client client = ClientBuilder.newClient();
return client.target(url)
.request(MediaType.APPLICATION_JSON)
.header("authorization",token)
.get(String.class);
在客户端get()方法中,每10-15次调用命中一次即可获得以下异常:
"status":500,"reason":"Internal Server Error","code":0,"message":
javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:284)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:278)
at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:767)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:229)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:765)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:428)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:324)
尤其是在负载测试期间,频繁失败API调用的原因可能是什么,我该如何解决?我已经尝试过在发送请求时忽略SSL证书并添加x509证书
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)