springmvc 文件上传报错org.springframework.web.util.NestedServletException
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade
出现错误的代码位置
MultipartHttpServletRequest multipartRequest=(MultipartHttpServletRequest)request;
解决方法需要在spring配置文件中添加如下内容
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="104857600"/> <property name="maxInMemorySize" value="4096"/> </bean>
使用上面代码还要确认lib中有commons-fileupload-1.2.2.jar 包否则启动时候报错
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.util.Log4jConfigListener java.lang.NoClassDefFoundError: org/apache/log4j/helpers/NullEnumeration at org.apache.log4j.Category.getAllAppenders(Category.java:413) at org.apache.log4j.Category.closeNestedAppenders(Category.java:226) at org.apache.log4j.Hierarchy.shutdown(Hierarchy.java:467) at org.apache.log4j.LogManager.shutdown(LogManager.java:267)
来源://作者:/更新时间:2014-02-13
顶
踩
相关文章: