当我调用休息服务时,我得到了ResourceAccessException。我不知道为什么会发生。可能是因为服务已关闭,但这是间歇性发生的。我想知道:
在我的踪迹中,我看到在2分钟7秒后引发了异常,必须在某个地方配置此超时时间,不是吗?
我正在使用Java 8,Spring Boot 1.5.10,并且我的服务客户端和服务器都部署在云服务器上。我已经在服务器中配置了证书。
try {
LOGGER.info("AuditLogDataMapper : doNetworkReqeustMessageAuditLog() :: sending....");
restTemplate.postForLocation(auditLogServiceHost, request);
LOGGER.info("AuthorizationApiBackend : Sent network message to Audit-log service");
return true;
} catch (RestClientException e) {
LOGGER.error("RestClientException in Audit-log Service", e);
}
我的例外:
2018/06/25 16:47:57,993 [INFO ] (AuditLogRestClient.java:45) com.santander.ck.splitter.web.restclient.AuditLogRestClient : AuditLogDataMapper : doNetworkReqeustMessageAuditLog() :: sending....
2018/06/25 16:50:04,869 [ERROR ] (AuditLogRestClient.java:54) com.santander.ck.splitter.web.restclient.AuditLogRestClient : RestClientException in Audit-log Service
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://ck-da-audit-log-da-processing-dev.appls.cap2.paas.gsnetcloud.corp/audit-log/audit": Connection timed out (Connection timed out); nested exception is java.net.ConnectException: Connection timed out (Connection timed out)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:674) ~[spring-web-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:621) ~[spring-web-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
at org.springframework.web.client.RestTemplate.postForLocation(RestTemplate.java:363) ~[spring-web-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
at com.santander.ck.splitter.web.restclient.AuditLogRestClient.doNetworkRequestMessageAuditLog(AuditLogRestClient.java:50) [classes!/:?]
at com.santander.ck.splitter.integration.AuthReportHandler.handle(AuthReportHandler.java:60) [classes!/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]