struts文件上传出错,如何解决?

s_phoenix 2004-10-18 01:30:32
运行到form时会出如下提示:
2004-10-18 13:15:42 org.apache.struts.upload.CommonsMultipartRequestHandler handleRequest
严重: Failed to parse multipart request
org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Connection reset
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:429)
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:195)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:445)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

但是文件实际上传成功!
我的form如下:
package com.cddx.mweb.struts.form;

import org.apache.struts.action.ActionForm;
import org.apache.struts.upload.FormFile;
/**
* UploadForm.java created by EasyStruts - XsltGen.
* http://easystruts.sf.net
* created on 10-11-2004
*
* XDoclet definition:
* @struts:form name="uploadForm"
*/
public class UploadForm extends ActionForm {

// --------------------------------------------------------- Instance Variables

/** theFile property */
protected FormFile theFile;

protected String savePath;

protected String project;
// --------------------------------------------------------- Methods

/**
* Retrieve a representation of the file the user has uploaded
*/
public FormFile getTheFile() {
return theFile;
}

/**
* Set a representation of the file the user has uploaded
*/
public void setTheFile(FormFile theFile) {
this.theFile = theFile;
}

public void setSavePath(String savePath) {
this.savePath = savePath;
}


public String getSavePath() {
return savePath;
}

public void setProject(String project) {
this.project = project;
}


public String getProject() {
return project;
}
}
为什么会出现那样的提示呢?如何解决?
...全文
310 1 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
s_phoenix 2004-11-02
设置了。
而且奇怪的是在本机(windows)上调试时才会出现上述错误。发布到服务器上(linux)就不会出错了。奇怪啊。
回复
funcreal 2004-11-01
org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Connection reset

你的form格式设置为multipart/form-data了吗?
<form name="form1" method="post" action="什么什么.do" enctype="multipart/form-data">
回复
s_phoenix 2004-10-18
这不和我的做法一样么?
我现在上传是每次都OK的,就是要出这个提示,讨厌啊!
回复
liusoft 2004-10-18
http://www.javayou.com/showlog.jspe?cat_id=-1&log_id=106

看看这个帖子:)
回复
发帖
Java EE
创建于2007-09-28

6.6w+

社区成员

J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
申请成为版主
帖子事件
创建了帖子
2004-10-18 01:30
社区公告
暂无公告