org.springframework.web.client.HttpServerErrorException: 500

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$$FastClassBySpringCGLIB$$904f5252.invoke(<generated>) ~[classes!/:1.0-SNAPSHOT]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.cloud.sleuth.instrument.async.TraceAsyncAspect.traceBackgroundThread(TraceAsyncAspect.java:65) ~[spring-cloud-sleuth-core-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
        at sun.reflect.GeneratedMethodAccessor973.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) ~[spring-aop-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_161]
        at org.springframework.cloud.sleuth.instrument.async.TraceRunnable.run(TraceRunnable.java:62) [spring-cloud-sleuth-core-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]

出现这样的请景一般就是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);

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值