赞
踩
org.springframework.web.client.HttpServerErrorException: 500
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:97) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:79) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:775) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:728) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:684) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:466) ~[spring-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
at ai.peanut.service.order.service.impl.PaymentContractServiceImpl.completePayscoreOrder(PaymentContractServiceImpl.java:199) ~[classes!/:1.0-SNAPSHOT]
at ai.peanut.service.order.service.impl.PaymentContractServiceImpl.noPasswordPay(PaymentContractServiceImpl.java:102) ~[classes!/:1.0-SNAPSHOT]
at ai.peanut.service.order.service.impl.PaymentContractServiceImpl
出现这样的请景一般就是RestTemplate执行网络超时或者是微服务之间网络调用超时熔断
解决方式:1、调长网关熔断时间
- ribbon.ConnectTimeout=20000
- ribbon.ReadTimeout=20000
- zuul.host.socket-timeout-millis=20000
- zuul.host.connect-timeout-millis=20000
- hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=20000
2、配置RestTemplate连接时间
- SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
- simpleClientHttpRequestFactory.setConnectTimeout(20000);
- simpleClientHttpRequestFactory.setReadTimeout(30000);
- restTemplate = new RestTemplate(simpleClientHttpRequestFactory);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。