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

來源:互聯網
上載者:User

標籤:gpo   基本   except   nbsp   iss   串連   .net   基本資料   ack   

最近在使用 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賦給各自的基本類型,編譯器不會報,但是你將會在運行時期遇到null 指標異常。

    這是Java中的自動拆箱導致的,任何含有null值的封裝類在Java拆箱產生基礎資料型別 (Elementary Data Type)時候都會拋出一個null 指標異常。

}      其部落格串連 :56014607

 

write是這樣的原因,  那麼  read  就是 傳入了空值諾  ???

我這裡使用了 vo類接收參數, 並且使用 了   @requsetBody 註解,  所以與上文原因類似~~~

一檢查果然是這樣的。。。。。

 

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.