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-2025 CODEPRJ.COM