zoukankan      html  css  js  c++  java
  • Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public xxxxxxxx.

    最近在使用 springBoot开发的时候, 使用PostMan访问接口,  返回一个 404 ,  后台报一个 warn :

          Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing:

              public com.syh.foundation.ResponseMessage com.xxxxx.list(xxxxx.vo.AppCostVo)

    检查了各个类, 排查了各个可能的地方都没有发现错误, 左后在网上 查找到有人  报   : Failed to write HTTP message  错误, 其解释为:

     {      

        这个异常是我在使用Spring中,在JavaBean中使用了包装类Integer,

        private Integer  pageNum;而在方法中使用了@ResponseBody注解,

        在return  map返回给前台时Spring中的类com.fasterxml.jackson.databind.JsonMappingException

        这个类会对包装类自动拆箱成对应的基本类型,如果返回的Integer中存在null的话,那么在拆箱成int时就会报错

        如果将null赋值给包装类Integer,然后将Integer赋给各自的基本类型,编译器不会报,但是你将会在运行时期遇到空指针异常。

        这是Java中的自动拆箱导致的,任何含有null值的包装类在Java拆箱生成基本数据类型时候都会抛出一个空指针异常。

    }      博客连接 :https://blog.csdn.net/wgs_93/article/details/56014607

    write是这样的原因,  那么  read  就是 传入了空值诺  ???

    我这里使用了 vo类接收参数, 并且使用 了   @requsetBody 注解,  所以与上文原因类似~~~

    一检查果然是这样的。。。。。

  • 相关阅读:
    TypeError: Iterator operand 0 dtype could not be cast from dtype('<M8[us]') to dtype('<M8[D]') according to the rule 'safe'
    Linux中matplotlib 中文显示问题解决
    自己动手实现爬虫scrapy框架思路汇总
    机器学习算法之多项式回归
    scrapy爬虫--苏宁图书
    Mongodb数据库基本操作
    day04 Python
    day03 Python爬虫
    day02 Python完结
    day01 python基础
  • 原文地址:https://www.cnblogs.com/soficircle/p/8681361.html
Copyright © 2011-2022 走看看