Apache 在尝试上传文件时返回此错误(我只保留了堆栈跟踪的第一行和根本原因):
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /upload.jsp:40
37:
38: try {
39:
40: items = upload.parseRequest(request);
41: } catch (FileUploadException e) {
42: out.println(e);
43: }
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
root cause
javax.servlet.ServletException: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContext;)Ljava/util/List;
root cause
java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContext;)Ljava/util/List;
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
这是我的代码:
if(ServletFileUpload.isMultipartContent(request)){
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
out.println(e);
}
}
我不明白,它看起来找不到 parseRequest() 方法,但是 ServletFileUpload 实例工作正常,所以看起来包在那里但是......
任何的想法?所有建议帮助表示赞赏!:)