Re: Error Struts 7
Lukasz Lenart <[email protected]> Sun, 5 Oct 2025 19:42:49 +0200
| Newsgroups | gmane.comp.jakarta.struts.user |
|---|---|
| Message-ID | <CAMopvkOMTf=X3ratc2U=5m6r4LCaoAbEf0uCUM-1JZHXQKc0Og@mail.gmail.com> |
wt., 30 wrz 2025 o 21:21 Ute Kaiser <[email protected]> napisa=C5=82(a): > I want to add some comments here about the somehow misleading documentati= on on this. > >> > Files Number Limit > > Since Struts 6.1.2 a new option was added, which uses Commons FileUpload = feature to limit how many files can be uploaded at once, in one request. Th= is option requires to use Commons FileUpload ver. 1.5 at least and by defau= lt is set to 256. Please always set this to a finite value to prevent DoS a= ttacks. > To change this value define a constant in struts.xml as follows: > <struts> > <constant name=3D"struts.multipart.maxFiles" value=3D"500"/> > </struts> > << > > Today, I used > <constant name=3D"struts.multipart.maxFiles" value=3D"3"/> > because I have 3 file upload tags on my mask. > But the application crashed, even with only one file upload, till I foun= d a debug message in wildfly server.log > >> > 2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.Ab= stractMultiPartRequest] (default task-2) Applies max size: xxx to file uplo= ad request > 2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.Ab= stractMultiPartRequest] (default task-2) Applies max files number: 3 to fil= e upload request > 2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.Ab= stractMultiPartRequest] (default task-2) Applies max size of single file: x= xx to file upload request > 2025-09-30 15:14:22,483 DEBUG [org.apache.struts2.dispatcher.multipart.Ab= stractMultiPartRequest] (default task-2) Error parsing the multi-part reque= st!: org.apache.commons.fileupload2.core.FileUploadFileCountLimitException:= attachment > at deployment.resy.ear//org.apache.commons.fileupload2.core.AbstractF= ileUpload.lambda$parseRequest$1(AbstractFileUpload.java:465) > at deployment.resy.ear//org.apache.commons.io.function.IOIterator.for= EachRemaining(IOIterator.java:77) > at deployment.resy.ear//org.apache.commons.fileupload2.core.AbstractF= ileUpload.parseRequest(AbstractFileUpload.java:462) > at deployment.resy.ear//org.apache.commons.fileupload2.jakarta.servle= t6.JakartaServletFileUpload.parseRequest(JakartaServletFileUpload.java:117) > at deployment.resy.ear//org.apache.struts2.dispatcher.multipart.Jakar= taMultiPartRequest.processUpload(JakartaMultiPartRequest.java:51) > << > Debugging org.apache.commons told me that all my parameters counted, not = only the fileupload parameter. Thanks for pointing this out, I can update the docs only as we base on what Commons Fileupload provides https://commons.apache.org/proper/commons-fileupload/commons-fileupload2-co= re/apidocs/org/apache/commons/fileupload2/core/AbstractFileUpload.html#setF= ileCountMax(long) Cheers =C5=81ukasz