springMVC使用multipartFile上传文件出错:MultipartHttpServletRequest: is a MultipartResolver configured?

1
2
3
4
5
6
7
8
17-Apr-2016 22:36:27.171 SEVERE [http-apr-8080-exec-4] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException:
 
 
Expected MultipartHttpServletRequest: is a MultipartResolver configured?]
 
 
with root cause
 java.lang.IllegalArgumentException: Expected MultipartHttpServletRequest: is a MultipartResolver configured?

这是因为找不到multipartReslover的原因,这很搞笑,在springMVC配置文件配置它的时候,不能用其他名字,只能用指定名字,否则就出现这种找不到的错误。

出错例子:



改正例子:



一定要用multipartResolver这个id名。


           





原文地址:https://www.cnblogs.com/share2015/p/5402670.html