springmvc-springMVC上传文件报错

问题描述

springMVC上传文件报错

09:13:59,716 ERROR [RequestUtils] Caught error while decoding priorityId.
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing o
f multipart/form-data request failed. Stream ended unexpectedly
at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:163)
at org.springframework.web.multipart.commons.CommonsMultipartResolver$1.initializeMultipart(CommonsMultipartResolver.java:131)
at org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest.getMultipartParameters(DefaultMultipartHttpServletRequest.java:163)
at org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest.getParameter(DefaultMultipartHttpServletRequest.java:80)
at com.gsol.enigma.web.util.RequestUtils.isLoggedInUniversal(RequestUtils.java:1310)
at com.gsol.enigma.web.util.RequestUtils.isLoggedIn(RequestUtils.java:1253)
at com.gsol.enigma.web.util.RequestUtils.getUser(RequestUtils.java:1058)
at com.gsol.cuckoo.util.common.RequestUtil.getUserLocale(RequestUtil.java:64)
at com.gsol.cuckoo.util.interceptor.I18nInterceptor.preHandle(I18nInterceptor.java:63)
at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:130)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:913)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.gsol.cuckoo.filter.LoginFilter.doFilter(LoginFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:115)
at org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)
at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:156)
... 42 more
Caused by: org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:1005)
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:903)
at java.io.InputStream.read(InputStream.java:101)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:100)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:347)
... 44 more

解决方案

http://blog.csdn.net/cheung1021/article/details/7084673

解决方案二:

http://www.2cto.com/kf/201412/360788.html

解决方案三:

我遇到同样的问题不知道如何解决,请大神指教

时间: 2024-10-30 02:54:28

springmvc-springMVC上传文件报错的相关文章

spring mvc-关于Spring mvc 向服务器上传文件报错问题

问题描述 关于Spring mvc 向服务器上传文件报错问题 Spring mvc在向服务器上传的文件的时候报错 显示系统找不到指定的路径,应该要怎么修改 解决方案 大文件上传到服务器报错的问题大文件上传到服务器报错的问题ASP.NET 上传Excel到服务器报错的问题 解决方案二: 错误粘出来看看,可能原因有很多 解决方案三: 代码是这个 @RequestMapping("/updateExcel") public String updateExcel(HttpServletRequ

get-winform使用webclient上传文件报错,是怎么回事???具体如下

问题描述 winform使用webclient上传文件报错,是怎么回事???具体如下 到底是怎么回事??附上服务端代码 protected void Page_Load(object sender, EventArgs e) { // 在此处放置用户代码以初始化页面 foreach (string f in Request.Files.AllKeys) { string hx=Request.QueryString ["picname"]; HttpPostedFile file =

三个思路解决laravel上传文件报错:413 Request Entity Too Large问题

最近一个项目当中,要求上传图片,并且限制图片大小,虽然在laravel当中已经添加了相关的表单验证来阻止文件过大的上传,然而当提交表单时,还没轮到laravel处理,nginx就先报错了.当你仔细看报错页面时,你会发现有nginx版本信息,经过分析,这报错是因为nginx的默认上传文件大小配置client_max_body_size只有2MB, 基于nginx验证比laravel验证要早,想要友好报错而不是直接显示413 Request Entity Too Large,那么就有三个思路去解决.

Spring MVC实现上传文件报错解决方案

报错代码: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.multipart.MultipartFile]: Specified class is an interface org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:101) o

Hadoop上传文件报错: name node is in safe mode

将本地文件拷贝到hdfs上去,结果上错误:Name node is in safe mode 这是因为在分布式文件系统启动的时候,开始的时候会有安全模式,当分布式文件系统处于安全模式的情况下,文件系统中的内容不允许修改也不允许删除,直到安全模式结束.安全模式主要是为了系统启动的时候检查各个DataNode上数据块的有效性,同时根据策略必要的复制或者删除部分数据块.运行期通过命令也可以进入安全模式.在实践过程中,系统启动的时候去修改和删除文件也会有安全模式不允许修改的出错提示,只需要等待一会儿即可

Rails文件上传file_field报错Encoding::UndefinedConversionError

服务器用的是ubuntu12 64bit,环境是ruby1.9.3+rails3+mysql,测试是在windows2003上. 上传 一个[.gitconfig]文件,没有问题,上传[新浪微博数据挖掘.pdf]报错,上传[back.jpg]报错. 下 面是两段信息,是从[log/production.log]中粘贴出来的.上面一段你是没有问题的日志,下面一段是报错 之后的日志. 01.Started POST "/posts" for 106.3.102.43 at 2012-10-

ajax-不使用form表单springmvc如何上传文件

问题描述 不使用form表单springmvc如何上传文件 项目中需要在之前哥们的代码中加上一个文件上传功能,但是之前哥们写的jsp中使用的div里嵌套的table,并没有使用form表单,提交使用的是ajax,将页面的数据转成json提交到后台的. 我如何在他的基础上将上传的文件传到后台呀?怎么接收,还是用他这个提交按钮?可以实现吗? 解决方案 这里用到HTML 标签的 enctype 属性. enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码. 默认地,表单数据会编码为 "

upload-求大神解答ssh上传文件报NullPointerException

问题描述 求大神解答ssh上传文件报NullPointerException 页面代码: Action: public String uplo() throws Exception{ String root=ServletActionContext.getServletContext().getRealPath(this.getSavePath()); System.out.println(root); FileInputStream in=new FileInputStream(upload)

ftpclient上传-FTPClient上传storeFile报错,求救

问题描述 FTPClient上传storeFile报错,求救 今天要写一个很简单的ftp上传的代码,结果总是报错,请教各位大神来帮忙解决 这是我的代码 public class UpLoadJSToFtp { /** * * @param url ftp服务器地址 * @param port ftp服务器端口号 * @param userName 登录账号 * @param password 登录密码 * @param path 服务器保存路径 * @param fileName 文件名 * @