分析异常org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.asiadb.common.core.domain.AjaxResult com.asiadb.web.controller.vcc.vccManage.vccCardInfo.VccCardInfoController.auditSuccess(com.asiadb.vcc.vccManage.vccCardInfo.domain.VccCardInfo) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:163) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:133) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:179) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:146) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
时间: 2023-12-11 11:05:13 浏览: 109
这个异常是由于请求的请求体缺失导致的。更具体地说,它发生在Spring MVC的RequestResponseBodyMethodProcessor中,该处理负责将请求体转换为方法参数。在这种情况下,方法是com.asiadb.web.controller.vcc.vccManage.vccCardInfo.VccCardInfoController.auditSuccess,它需要一个类型为com.asiadb.vcc.vccManage.vccCardInfo.domain.VccCardInfo的参数。但是,请求中缺少这个参数,因此无法将请求体转换为方法参数,从而导致了这个异常。
相关问题
org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public
***这些方法都没有在请求中找到必需的请求体。
根据引用的原因解释,这个问题可能是由于使用了"@RequestBody"注解但实际请求没有进入该控制器方法所导致的。解决方法是将"@RequestBody"注解替换为"@PathVariable"。
因此,解决这个问题的方法是将"@RequestBody"注解替换为"@PathVariable",以确保请求体能够正确传递到控制器方法中。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [org.springframework.http.converter.HttpMessageNotReadableException错误原因及解决办法](https://blog.csdn.net/qq_43055855/article/details/110095103)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing](https://blog.csdn.net/z1427094386/article/details/120386072)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing
引用[1]和[2]中的报错信息显示,出现了"org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing"的异常。这个异常通常是因为在请求中缺少了必需的请求体。引用[3]中提到,可能是因为后台代码中使用了@RequestBody注解,但前端发送的请求没有进入这个controller。解决方法是将@RequestBody换成@PathVariable。所以,要解决这个异常,你可以检查一下你的请求是否缺少了必需的请求体,并确保后台代码中的注解使用正确。
阅读全文