当前位置:   article > 正文

org.springframework.web.client.HttpServerErrorException: 500_org.springframework.web.client.defaultresponseerro

org.springframework.web.client.defaultresponseerrorhandler.handleerror(defau

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、调长网关熔断时间

  1. ribbon.ConnectTimeout=20000
  2. ribbon.ReadTimeout=20000
  3. zuul.host.socket-timeout-millis=20000
  4. zuul.host.connect-timeout-millis=20000
  5. hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=20000

2、配置RestTemplate连接时间

  1. SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
  2. simpleClientHttpRequestFactory.setConnectTimeout(20000);
  3. simpleClientHttpRequestFactory.setReadTimeout(30000);
  4. restTemplate = new RestTemplate(simpleClientHttpRequestFactory);

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/657839
推荐阅读
相关标签
  

闽ICP备14008679号