You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/01/21 10:25:12 UTC
DO NOT REPLY [Bug 26305] New: -
Encountering "java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax(I)V" Error Message After Clicking Submit When Using the tag
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26305>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26305
Encountering "java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax(I)V" Error Message After Clicking Submit When Using the <html:file> tag
Summary: Encountering "java.lang.NoSuchMethodError:
org.apache.commons.fileupload.FileUpload.setSizeMax(I)V"
Error Message After Clicking Submit When Using the
<html:file> tag
Product: Struts
Version: Nightly Build
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: File Upload
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: charleschen70@yahoo.com
I encountered following error when clicking the Submit button:
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoSuchMethodError:
org.apache.commons.fileupload.FileUpload.setSizeMax(I)V
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
(CommonsMultipartRequestHandler.java:220)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:934)
org.apache.struts.action.RequestProcessor.processPopulate
(RequestProcessor.java:779)
org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:246)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
In the org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest()
method, it creates a DiskFileUpload object and calls the setSizeMax() method
with a type casting to int:
public void handleRequest(HttpServletRequest request)
throws ServletException {
// Get the app config for the current request.
ModuleConfig ac = (ModuleConfig) request.getAttribute(
Globals.MODULE_KEY);
// Create and configure a DIskFileUpload instance.
DiskFileUpload upload = new DiskFileUpload();
// Set the maximum size before a FileUploadException will be thrown.
upload.setSizeMax((int) getSizeMax(ac));
However, the setSizeMax is not found in the
org.apache.commons.fileupload.DiskFileUpload class. The setSizeMax method is
defined in the superclass FileUploadBase but it expects a long method:
public void setSizeMax(long sizeMax)
{
this.sizeMax = sizeMax;
}
Either the DiskFileUpload class needs to override the default setSizeMax
method or the CommonsMultipartRequestHandler.request method needs to pass in a
long value to set the max size.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org