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