开发项目过程中,需要将图片资源上传到ftp服务器,使用nginx反向代理来访问图片服务器。在使用springmvc的文件上传的过程中发生如下异常:
SEVERE: Servlet.service() for servlet [taotao-manager] 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?
..........
..........
错误分析:没有在springmvc的核心配置文件中配置支持文件上传的解析器
解决方案:在springmvc.xml文件中定义文件上传解析器即可