学习SpringCloud Feign时,通过url访问Controller,后台报错

2018-03-21 21:05:09.849  INFO 31732 --- [nio-8765-exec-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: service-hi.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2018-03-21 21:05:09.851  INFO 31732 --- [nio-8765-exec-1] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client service-hi initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=service-hi,current list of Servers=[WenderThinkPad:8762, WenderThinkPad:8763],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;  Instance count:2;   Active connections count: 0;    Circuit breaker tripped count: 0;   Active connections per server: 0.0;]
},Server stats: [[Server:WenderThinkPad:8763;   Zone:defaultZone;   Total Requests:0;   Successive connection failure:0;    Total blackout seconds:0;   Last connection made:Thu Jan 01 08:00:00 CST 1970;  First connection made: Thu Jan 01 08:00:00 CST 1970;    Active Connections:0;   total failure count in last (1000) msecs:0; average resp time:0.0;  90 percentile resp time:0.0;    95 percentile resp time:0.0;    min resp time:0.0;  max resp time:0.0;  stddev resp time:0.0]
, [Server:WenderThinkPad:8762;  Zone:defaultZone;   Total Requests:0;   Successive connection failure:0;    Total blackout seconds:0;   Last connection made:Thu Jan 01 08:00:00 CST 1970;  First connection made: Thu Jan 01 08:00:00 CST 1970;    Active Connections:0;   total failure count in last (1000) msecs:0; average resp time:0.0;  90 percentile resp time:0.0;    95 percentile resp time:0.0;    min resp time:0.0;  max resp time:0.0;  stddev resp time:0.0]
]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@64365eb
2018-03-21 21:05:10.017 ERROR 31732 --- [nio-8765-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.FeignException: status 400 reading SchedualServiceHi#sayHiFromCientOne(String); content:
{"timestamp":"2018-03-21T13:05:09.995+0000","status":400,"error":"Bad Request","message":"Required String parameter 'name' is not present","path":"/hi"}] with root causefeign.FeignException: status 400 reading SchedualServiceHi#sayHiFromCientOne(String); content:
{"timestamp":"2018-03-21T13:05:09.995+0000","status":400,"error":"Bad Request","message":"Required String parameter 'name' is not present","path":"/hi"}at feign.FeignException.errorStatus(FeignException.java:62) ~[feign-core-9.5.1.jar:na]at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91) ~[feign-core-9.5.1.jar:na]at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138) ~[feign-core-9.5.1.jar:na]at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-9.5.1.jar:na]at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) ~[feign-core-9.5.1.jar:na]at com.sun.proxy.$Proxy79.sayHiFromCientOne(Unknown Source) ~[na:na]at com.fhbean.springboot.controller.HiController.sayHi(HiController.java:20) ~[classes/:na]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:870) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:776) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.28.jar:8.5.28]at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.28.jar:8.5.28]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.28.jar:8.5.28]at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]2018-03-21 21:05:10.830  INFO 31732 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: service-hi.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647

给Controller的@RequestParam注解补全@RequestParam(value = "name", required = false)后,后台仍然是相同的错误提示。仔细观察错误提示,发现已经成功执行到Controller的方法体了。在调用接口的方法时出错了SchedualServiceHi.sayHiFromCientOne(name)。

@FeignClient(value = "service-hi")
public interface SchedualServiceHi {@RequestMapping(value = "/hi", method = RequestMethod.GET)public String sayHiFromCientOne(String name);
}

原来是sayHiFromClientOne()没为name参数添加@RequestParam注解。按如下方式修改,问题解决。

@FeignClient(value = "service-hi")
public interface SchedualServiceHi {@RequestMapping(value = "/hi", method = RequestMethod.GET)public String sayHiFromCientOne(@RequestParam(value = "name") String name);
}

Required String parameter 'xxx' is not present相关推荐

  1. mybaties :required string parameter ‘XXX‘is not present

    情况一:原因是由于头文件类型不对,可以在MediaType中选择合适的类型,例如GET和POST 情况二:jquery提交delete时,不支持@RequestParam,只支持@PathVariab ...

  2. Required string parameter ‘XXX‘ is not present

    一.错误描述 写了一个页面登录的方法,在进行页面登录的时候,控制台会报类似Required String parameter 'XXX' is not present 错误. 1.错误信息 控制台日志 ...

  3. Required String parameter XXX is not present

    仅限于我在后台开发调试中遇到的这个问题,并且找到原因,解决的. H5前端调Springboot后台接口时,报了以下错误: 这个问题之前也遇到过,只是忘了怎么解决的,什么原因导致的. 这次又遇到了这个问 ...

  4. 报错:Required String parameter 'XXX' is not present错误的几种可能性

    背景了解: 同事对代码做了改动,他在后台把原本接收的参数"username"改成了"id",没有把修改的事情通知我.拿到代码运行后发现前台网页的内容显示不完整了 ...

  5. 请求报错Required String parameter 'xxx' is not present

    关于ajax请求spring后台出现 Required String parameter 'xx' is not present异常,  如果前端传入的是json数据那么后端使用 @RequestBo ...

  6. 【报错】required string parameter ‘XXX‘is not present

    报错原因是后端没有收到对应参数. 可以在@RequestParam(value = '', requried = false) Postman检查

  7. Required Integer[] parameter ‘xxx‘ is not present”报错的解决方案

    背景 在使用批量删除的时候,前端同学说报错了. 自我调试了下,发现Required Integer[] parameter 'xxx' is not present 方法在后端使用的是post的方式. ...

  8. HTTP Status 400 - Required String parameter '/q' is not present

    今天在敲项目的时候遇到了这样的问题,HTTP Status 400 - Required String parameter '/q' is not present.翻译过来就是所需字符串q不存在,这个 ...

  9. python抓包遇到Status 400 - Required String parameter ‘params‘ is not present错误

    用Charles抓包app门禁,在post的时候,总是报错Required String parameter 'zoneCode' is not present body = {'devcode': ...

最新文章

  1. 数据结构——线性结构
  2. API 分页设计与实现探讨
  3. [转载]TEQC命令集合
  4. LINUX DHCP搭建
  5. 几家OA厂商介绍及产品特点总结
  6. 【Python】最新Python学习路线(完整详细版,含整套教程)
  7. Django之ORM对数据库操作
  8. 自考计算机成绩,自考成绩计算机中是什么意思?
  9. 【Xamarin挖墙脚系列:Xamarin.IOS机制原理剖析】
  10. 查看php文件的效果,HTML5的交互式动画效果文件夹预览查看特效
  11. 十一这里最好玩啦!快来一起玩耍!
  12. ASP.NET读取Word文档转换为PDF文件的方法
  13. c语言编程绝对质数,C语言《绝对素数》
  14. 小学计算机机器人大赛,2019年花都区中小学电脑机器人竞赛活动
  15. TeX 主题选讲:TeX 处理器的结构(转)
  16. 显卡优化以提高计算机性能,《绝地求生》完美显卡优化教程:低配电脑也能吃鸡无压力!...
  17. java高德地图api开发平台_示例中心
  18. 为什么说信息是负熵?
  19. poj1386 Paly onWords
  20. KVC基本原理和用法

热门文章

  1. python——关于“霍兰德人格分析雷达图”代码运行错误解决
  2. 西游记里最厉害的法宝——手机
  3. lass翻译_lass
  4. Devcon有感:技术与应用发展失衡 牛市曙光尚远
  5. yii2 设置定时任务
  6. 启动android模拟器 命令,使用命令启动android emulator
  7. 李小璐晒全家福 贾乃亮赤膊女儿可爱(图)
  8. 新手入门期货需要懂哪些道理(新手入门期货需要懂哪些道理知识)
  9. 大数据中的数据的价值的大小的度量
  10. getinfo.html