java.lang.ClassCastException: org.apache.catalina.connector. RequestFacade

cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest

在用springMvc做上传文件的时候报这个错误,在网上查了一天,总结一下大致有几种情况:

一: jsp页面的表单没有设置 enctype="multipart/form-data" 且要设置为 "post" 方式提交

<form action="" method="post"  enctype="multipart/form-data">

二:springMvc中没有配置文件上传:

<bean id="multipartResolver"  
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">  
        <!-- set the max upload size100MB -->  
        <property name="maxUploadSize">  
            <value>104857600</value>  
        </property>  
        <property name="maxInMemorySize">  
            <value>4096</value>  
        </property> 
        <property name="defaultEncoding">
			<value>utf-8</value>
		</property>
    </bean>  
三:必要的jar包没有导入。

四:如果你上边的都没有问题,那么就是你只用了一个浏览器在测试,要清除缓存!!对,没有错,缓存!!

这是小弟查百度总结的东西,希望对各位程序猿有帮助。

java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest在用springMvc做上传文件的时候报这个错误,在网上查了一天,总结一下大致有几种情况: 主要指编码、环境、用户操作输入出现问题,Exception主要包括两大类: oRuntimeException:运行时异常,也叫非检查异常(NullPointerException、ArrayIndexOutOfBoundsException、 ClassCastException 、ArithmeticException),会由 Java 虚拟机自动抛出并自动捕获,此类异常的出现绝大数情况是代码本身有问题,应该从逻辑上去解决并改进代码 o检查异常(其他的一些异常):引起该异常的原因多种多样,比如说文件不存在或者是连接错误。该异常必须手动在代码里添加捕获语句来处理该异常。从程序语法角度讲是必须警醒处理的异常,如果不处理,程序就不能编译通过。 Registering type handler against HashMap causes ClassCastException . #1089 Unable to register TypeHandler once TypeHandlerRegistry.hasTypeHandler is called. #1177 Serializing and deserializing cached objects causes NullPointerException. #1084 Invalid error message 'Two methods with same method signature but not providing classes assignable?' in System.err. #929 java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade cannot be cast to org .springframework.web.multipart.MultipartHttpServlet Request &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&g... java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade cannot be cast to org .springframework.web.multipart.MultipartHttpServlet Request 实现springMvc文件上传报如上错误: 问题出现的原因
java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade cannot be cast to org .springframework.web.multipart.MultipartHttpServlet Request 严重: Servlet.service() f...
Java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade cannot be cast to org .springframework.web.multipart.MultipartHttpServlet Request 在用springMvc做上传文件的时候报这个错误,在网上查了一天,总结一下大致有几种情...
cannot be cast to java x.servlet.Filter 报错, 原因servlet-api.jar冲突 使用maven开发web应用程序, 启动的时候报错: jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: java x/servlet/Servlet.class 然后输出错误: 严重: Exception starting filter encodingFilter java . lan g. ClassCastException : org .springframework.web.f
Load canal adapter: es7 failed java . lan g.RuntimeException: java . lan g.RuntimeException: java . lan g. ClassCastException : com.alibaba.druid.pool.DruidDataSource cannot be cast to com.alibaba.druid.pool.DruidDataSource canal-adapter1.1.5报错, 将client-adapter.es7x-1.1.5-SNAPSHOT-jar-with-dependencies.jar 替换掉release版本的plugin文件的 client-adapter.es7x-1.1.5-jar-with-dependencies.jar
SpringMVC文件上传报错: java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade cannot be cast to org .springframework.web.multipart.MultipartHttpServlet Request ....... 1.先看下页面的form表单中是否添加了: enctype =“multipart/form-data” 2.springMVC appli cat io
java . lan g. classcastexception : java . lan g.string cannot be cast to java . lan g.long
weixin_48426237: 求助 drop了数据表 可以用这个方法吗?我一直在报错,一直修改不过来。。。 select * from ipomd_HR_MachineSalesAward as of timestamp sysdate - 240/1440 > 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'timestamp sysdate - 240/1440' at line 1 select * from ipomd_HR_MachineSalesAward as of timestamp '2023-01-18 15:00:00' React出现错误:Uncaught TypeError: this.setState is not a function qq_40309746: 不支持箭头函数怎么办呢 Mybatis出现Mapped Statements collection already contains value for ling_llllll: 第一种,赞 Mysql事务隔离级别-简单易懂 Crzis: 你不会加好友啊