java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade 
cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest

实现springMvc文件上传报如上错误:
问题出现的原因
1.在前端页面提交的表单中没有 enctype="multipart/form-data" 属性,或者提交的方式不正确
2.在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>
java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade ca nnot be ca st to org .springframework.web.multipart.MultipartHttpServlet Request >>>>>>>>>>>&gt... Load ca nal adapter: es7 failed java . lan g.RuntimeException: java . lan g.RuntimeException: java . lan g. ClassCastException : com.alibaba.druid.pool.DruidDataSource ca nnot be ca st to com.alibaba.druid.pool.DruidDataSource ca nal-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 ca nnot be ca st 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 java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade ca nnot be ca st 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 ca nnot be ca st to org .springframework.web.multipart.MultipartHttpServlet Request 严重: Servlet.service() f... Java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade ca nnot be ca st to org .springframework.web.multipart.MultipartHttpServlet Request 在用 springMvc 上传文件 的时候报这个错误,在网上查了一天,总结一下大致有几种情况 HttpServlet Request request = (HttpServlet Request ) req; HttpServletResponse response = (HttpServletResponse) resp; 写错成了: HttpServlet Request request = (HttpServlet Request ) req; HttpServletResponse response = (HttpS.. Java . lan g. ClassCastException : org . apache . cat a lin a. connector . Request Facade ca nnot be ca st to org .springframework.web.multipart.MultipartHttpServlet Request 在用 springMvc 上传文件 的时候报这个错误,在网上查了一天,总结一下大致有几种情...