这里写自定义目录标题
open feign调用直接走了熔断,post请求并且携带参数时会出现
如何打印熔断报错
直接走熔断、不进入到下游服务的问题,直接打印出熔断的异常是最快定位到问题的方法:
feign.hystrix.enabled: false

设置为false即不走熔断,可看到异常信息:
Exception:public class feign.codec.EncodeException
feign.codec.EncodeException: 'Content-Type' cannot contain wildcard type '*'
at feign.ReflectiveFeign$BuildEncodedTemplateFromArgs.resolve(ReflectiveFeign.java:349)
at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.create(ReflectiveFeign.java:213)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:72)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
at com.sun.proxy.$Proxy287.saleGoods(Unknown Source)
at com.xinchan.xcauto.merchants.common.service.local.GoodsCommonManager.goodsStockHandle(GoodsCommonManager.java:99)
at com.xinchan.xcauto.merchants.saas.service.impl.WorkSheetSaasServiceImpl.directDeductCardForWorksheet(WorkSheetSaasServiceImpl.java:1422)
at com.xinchan.xcauto.merchants.saas.service.impl.WorkSheetSaasServiceImpl.workSheetSave2(WorkSheetSaasServiceImpl.java:1389)
at com.xinchan.xcauto.merchants.saas.service.impl.WorkSheetSaasServiceImpl$$FastClassBySpringCGLIB$$b3d46479.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at com.xinchan.xcauto.merchants.saas.service.impl.WorkSheetSaasServiceImpl$$EnhancerBySpringCGLIB$$641bc059.workSheetSave2(<generated>)
at com.xinchan.xcauto.merchants.common.controller.WorkSheetCommonController.workSheetSave2(WorkSheetCommonController.java:<

open feign在进行POST请求并带有参数时遭遇直接熔断。为快速定位问题,可以通过关闭熔断feign.hystrix.enabled: false来显示异常信息。异常的根源可能在于系统中使用了fastjson的MessageConverter但未指定SupportedMediaTypes,这与Spring Boot默认的Jackson冲突,导致问题发生。
最低0.47元/天 解锁文章
1108

被折叠的 条评论
为什么被折叠?



