nested exception is java.lang.IllegalStateException: Optional int parameter 'xxx' is present


出現異常
nested exception is java.lang.IllegalStateException: Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

翻譯:
嵌套異常為java.lang.IllegalStateException:存在可選的int參數'id',但由於被聲明為原始類型,因此無法轉換為null值。 考慮將其聲明為相應原始類型的對象包裝。

原因:
1、后台controller接收參數不能為空,前台傳了空值。例如:int不能接收空值,integer可以接收空值。
2、前后台參數類型不一致,檢查controller參數類型。
3、前台的參數過長導致丟失了參數,在tomcat的server.xml里面添加maxPostSize="0"。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM