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删除。



猜您在找 Tomcat上java.lang.IllegalStateException: Optional int parameter 'id' is not present nested exception is java.lang.IllegalStateException: java.lang.IllegalStateException: Optional int parameter 'id' is not present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrappe springmvc:Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class XXX from ClassLoader [ParallelWebappClassLoader Springboot 上传报错: Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceede FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: PathVariable annotation was empty on param 0. 使用springSecurity报Unexpected AOP exception; nested exception is java.lang.IllegalStateException: Unable to load cache item Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8] Springboot 上传报错: Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceede 启动报错:Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous map
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM