Tomcat上java.lang.IllegalStateException: Optional int parameter 'id' is not present
今日, 本人在tomcat+spring mvc平台的服务器上遇到java.lang.IllegalStateException: Optional int parameter 'id' is not present异常, 很是怪异, mvc方法里面的id为int型, 明明是有值的, 为什么说没有? 改为Integer也不行, mvc方法直接无响应!
然后, 在本地模拟改用例, 发现可以正常执行, 而另一个同事说要把超长的图片参数放到Mvc方法的最后就可以正常访问! 怪异!
后来经过多次试验, 发现是其他参数的长度很长很长,例如存放图片的base64, 可能会超出tomcat的默认的post最多长度(2M), 但是网上很多人说超长抛出的异常应该是"post too large", 但是却抛出了另一种异常: :java.lang.IllegalStateException: Optional int parameter 'id' is not prese nt but cannot be translated into a null value due to being declared as a primiti ve type. Consider declaring it as object wrapper for the corresponding primitive type.
本人的理解是sping mvc忽略了post too large异常, 直接对请求参数内容进行截取, 导致了id参数为空, 因此才出现了这样怪异的现象.
解决的办法当然就是在tomcat的server.xml里面加一个maxPostSize="0"
Tomcat上java.lang.IllegalStateException: Optional int parameter 'id' is not present的更多相关文章
- 访问tomcat出现java.lang.IllegalStateException No output folder错误解决方法
访问tomcat出现java.lang.IllegalStateException: No output folder错误解决方法 问题:tomcat分为安装版和解压缩版,解压缩版如果解压到安装盘,在 ...
- Optional int parameter 'rows' is not present but cannot be translated into a null value due to being declared as a primitive type.
我的spring mvc 代码: @Controller @RequestMapping("/product") public class Fancy { @RequestMapp ...
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
这个错误可以将参数由int改为Integer
- Optional int parameter 'resourceState' is present but cannot be translated into a null value
错误日志: java.lang.IllegalStateException: Optional int parameter 'resourceState' is present but cannot ...
- 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
Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The ...
- 云笔记项目- 上传文件报错"java.lang.IllegalStateException: File has been moved - cannot be read again"
在做文件上传时,当写入上传的文件到文件时,会报错“java.lang.IllegalStateException: File has been moved - cannot be read again ...
- tomcat启动报错:java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
tomcat日志: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start com ...
- 访问tomcat出现HTTP Status 500 - java.lang.IllegalStateException: No output folder
问题:tomcat分为安装版和解压缩版,解压缩版如果解压到安装盘,在浏览器中访问http://localhost:8080,可能会出现500错误,错误提示如下: localhost:8080 jav ...
- Tomcat部署项目时出错java.lang.IllegalStateException: ContainerBase.addChild: start:org.apache.catalina.Life
Tomcat部署项目时出错java.lang.IllegalStateException: ContainerBase.addChild: start:org.apache.catalina.Life ...
随机推荐
- arch中yaourt的安装和使用
yaourt-Yet AnOther User Repository Tool Yaourt是archlinux方便使用的关键部件之一,但没有被整合到系统安装中的工具.建议在装完系统重启之后,更新完p ...
- ew做socks5代理
这个工具和之前讲过的xxoo类似.链接:https://www.cnblogs.com/nul1/p/8883271.html https://zhuanlan.zhihu.com/p/3282215 ...
- Java的9种基本数据类型的大小,以及他们的封装类
由于java程序是运行在虚拟机之上的,所以java的基本数据类型的大小是确定的,不会随着操作系统的位数的改变而改变. 在计算机中,存储的是0,1,0,1这样的二进制位,表示为bit,1Byte = 8 ...
- git - 开发者电脑与服务器的配置
首先公司要有一台git服务器,现在一般都托管在github服务器上,在中国可能会托管到oschina上,oschina有一点好处就是可以免费托管私有项目,而在github上想要托管自己的项目是收费的, ...
- 设计模式之笔记--工厂方法模式(Factory Method)
工厂方法模式(Factory Method) 定义 工厂方法模式(Factory Method),定义一个用于创建对象的接口,让子类决定实例化哪一个类.工厂方法使一个类的实例化延迟到其子类. 类图 描 ...
- 转载: GIt远程操作详解
Git远程操作详解 作者: 阮一峰 日期: 2014年6月12日 Git是目前最流行的版本管理系统,学会Git几乎成了开发者的必备技能. Git有很多优势,其中之一就是远程操作非常简便.本文详细介 ...
- PHP的数据类型
原始类型共8种: 1, 4种标量类型:boolean(布尔型).integer(整形).float/double(浮点型).string(字符串型): 2, 2种复合型:array(数组).o ...
- java字节码指令列表(转)
字节码 助记符 指令含义 0x00 nop 什么都不做 0x01 aconst_null 将null推送至栈顶 0x02 iconst_m1 将int型-1推送至栈顶 0x03 iconst_0 将i ...
- redis之(十三)redis的三种启动方式
Part I. 直接启动 下载 官网下载 安装 tar zxvf redis-2.8.9.tar.gz cd redis-2.8.9 #直接make 编译 make #可使用root用户执行`make ...
- Subsets I&&II——经典题
Subsets I Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a s ...