java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0异常问题

今天在一个基于Spring Cloud开发的项目上添加了一个远程调用另外一个微服务的程序接口,在重新启动程序进行测试时出现如下异常:

Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
    at feign.Util.checkState(Util.java:128)
    at org.springframework.cloud.netflix.feign.annotation.RequestParamParameterProcessor.processArgument(RequestParamParameterProcessor.java:63)
    at org.springframework.cloud.netflix.feign.support.SpringMvcContract.processAnnotationsOnParameter(SpringMvcContract.java:238)
    at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:107)
    at org.springframework.cloud.netflix.feign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:133)
    at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
    at feign.hystrix.HystrixDelegatingContract.parseAndValidatateMetadata(HystrixDelegatingContract.java:34)
    at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:146)
    at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:53)
    at feign.hystrix.HystrixFeign$Builder.target(HystrixFeign.java:59)
    at org.springframework.cloud.netflix.feign.HystrixTargeter.targetWithFallbackFactory(HystrixTargeter.java:78)
    at org.springframework.cloud.netflix.feign.HystrixTargeter.target(HystrixTargeter.java:53)
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:145)
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:166)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
    ... 42 common frames omitted

前面还有更长的异常信息,这里只是列出了控制台输出的最底层的异常信息,关键问题在于提示的异常信息是

RequestParam.value() was empty on parameter 0

排查了下代码发现在新添加的通过Feign调用远程微服务接口的参数中在注解@RequestParam上书写错误

ReturnResultObject updateBatchNumberStatus(@RequestParam List<String> billID_list);

是在注解后面缺少了表示参数名的属性值,应该写成如下:

ReturnResultObject updateBatchNumberStatus(@RequestParam("billID_list") List<String> billID_list);

犯了一个小错误,这里记录一下,防止后面再犯这样的错误。

 

本文转载自:https://blog.csdn.net/jxm007love/article/details/80109974

posted @ 2020-12-19 14:31  Journey&Flower  阅读(1375)  评论(0编辑  收藏  举报