In a feign call, there is a requirement to query the order according to the order number. The interface is as follows:
@FeignClient(name = "order", path = "/")
public interface OrderFeignService {
@GetMapping(value = "/order/{orderNumber}")
BizOrderModel checkBizOrderExist(@PathVariable("orderNumber") String orderNumber);
}
The implementation is as follows:
@RestController
@RequestMapping("/")
public class OrderController implements OrderFeignService {
@Override
@GetMapping(value = "/order/{orderNumber}")
public BizOrderModel checkBizOrderExist(@PathVariable("orderNumber") String orderNumber) {
return orderService.findByOrderNumber(orderNumber);
}
}
The call is as follows:
@Service
@Slf4j
public class OrderService {
@Autowired
OrderFeignService orderFeignService;
public void test(){
if (null == orderFeignService.checkBizOrderExist(dto.getOrderNumber())) {
LOG.ERROR("Order information does not exist");
}
}
The exception message is as follows.
feign.FeignException: status 404 reading XXXXClient#XXXXMethod(Long)
at feign.FeignException.errorStatus(FeignException.java:62)
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
at com.sun.proxy.$Proxy97.querySpuDetailBySpuId(Unknown Source)
at XXXX(IndexService.java:41)
at XXXX(ElasticsearchTest.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
…
Anomaly Exclusion.
That is, when the input of the get request is null, such as the orderNumber in this example is not passed, feign call will report 404!
Read More:
- Feign declarative call service feign.codec.DecodeException: Error while extracting response for type [class **] and…
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- [Solved] Feign Error: -‘oauth-client.FeignClientSpecification‘ could not be registered
- Error (17) solves the problem of losing the request header of multithread asynchronous feign call
- [Solved] error: taking address of temporary array av_make_error_string((char[AV_ERROR_MAX_STRING_SI…
- [Solved] failed (13: Permission denied) while reading upstream
- POI Export Excel Error: HTTP Status 500 – Request processing failed; nested exception is java.lang.NullPointerException
- [Solved] Tensorflow/Keras Error reading weights: ValueError: axes don‘t match array
- How to parse JSON string in.Net [error reading job object from jsonreader. Current jsonreader item is not an obj]
- The request was rejected because the URL contained a potentially malicious String “;” [How to Solve]
- [Solved] kettle Error: Unexpected problem reading shared objects from XML file: null
- [Solved] java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell
- RabbitMQ:[error] Error when reading /Users/sixcandy/.erlang.cookie: eacces
- [Solved] “errmsg” : “Got invalid BSON from external server while reading from cursor
- [Solved] react18 swiper Error: Cannot read properties of undefined (reading ‘wrapperClass’)
- [Solved] Error reading comm device when writing serial communication with MSComm control
- Jackson localdatetime to string error: jsr310 [How to Solve]
- RuntimeError: CUDNN_STATUS_EXECUTION_FAILED [How to Solve]
- JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token
- Android Studio Error: String index out of range 0 [How to Solve]