zoukankan      html  css  js  c++  java
  • Required request body is missing错误

    错误提示如下:

    org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.atguigu.commonutils.R com.atguigu.educenter.controller.UcenterMemberController.loginUser(com.atguigu.educenter.entity.UcenterMember)
        at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:161)
        at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:131)
        at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)
        at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167)
        ........
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)

    原因:

    @RequestBody中值没有获取到, 它对应的是@PostMapping, 而这里使用的是@Get提交方式

     更改之后:

    使用swagger要注意的地方

     后面的 "," 不能多也不能少, 不然报错

    缺少逗号报错信息

    Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate Object entries
     at [Source: (PushbackInputStream); line: 3, column: 4]

    多了逗号报错信息

    Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)): was expecting double-quote to start field name
     at [Source: (PushbackInputStream); line: 4, column: 2]
  • 相关阅读:
    Matplotlib绘图双纵坐标轴设置及控制设置时间格式
    https://www.cnblogs.com/xubing-613/p/5895948.html
    Python科学计算技巧积累四——双y轴图像绘制
    卡尔曼滤波(Kalman Filter)
    python os.path模块常用方法详解 ZZ
    C/C++跨平台的的预编译宏
    WEB版一次选择多个图片进行批量上传(WebUploader)的解决方案
    WEB版一次选择多个文件进行批量上传(WebUploader)的解决方案
    学习ASP.NET MVC(十一)——分页
    学习ASP.NET MVC(十)——排序
  • 原文地址:https://www.cnblogs.com/ooo888ooo/p/13551784.html
Copyright © 2011-2022 走看看