Re: Error Struts 7

Ute Kaiser <[email protected]> Tue, 30 Sep 2025 21:12:49 +0200
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
I want to add some comments here about the somehow misleading documentation o=
n this.
>>
Files Number Limit

Since Struts 6.1.2 a new option was added, which uses Commons FileUpload fea=
ture to limit how many files can be uploaded at once, in one request. This o=
ption requires to use Commons FileUpload ver. 1.5 at least and by default is=
 set to 256. Please always set this to a finite value to prevent DoS attacks=
.
To change this value define a constant in struts.xml as follows:
<struts>
    <constant name=3D"struts.multipart.maxFiles" value=3D"500"/>
</struts>
<<
=20
Today, I used=20
<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 found a=
 debug message in wildfly server.log
>>
2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.Abstr=
actMultiPartRequest] (default task-2) Applies max size: xxx to file upload r=
equest
2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.Abstr=
actMultiPartRequest] (default task-2) Applies max files number: 3 to file up=
load request
2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.Abstr=
actMultiPartRequest] (default task-2) Applies max size of single file: xxx t=
o file upload request
2025-09-30 15:14:22,483 DEBUG [org.apache.struts2.dispatcher.multipart.Abstr=
actMultiPartRequest] (default task-2) Error parsing the multi-part request!:=
 org.apache.commons.fileupload2.core.FileUploadFileCountLimitException: atta=
chment
    at deployment.resy.ear//org.apache.commons.fileupload2.core.AbstractFile=
Upload.lambda$parseRequest$1(AbstractFileUpload.java:465)
    at deployment.resy.ear//org.apache.commons.io.function.IOIterator.forEac=
hRemaining(IOIterator.java:77)
    at deployment.resy.ear//org.apache.commons.fileupload2.core.AbstractFile=
Upload.parseRequest(AbstractFileUpload.java:462)
    at deployment.resy.ear//org.apache.commons.fileupload2.jakarta.servlet6.=
JakartaServletFileUpload.parseRequest(JakartaServletFileUpload.java:117)
    at deployment.resy.ear//org.apache.struts2.dispatcher.multipart.JakartaM=
ultiPartRequest.processUpload(JakartaMultiPartRequest.java:51)
<<
Debugging org.apache.commons told me that all my parameters counted, not onl=
y the fileupload parameter.

Best regards Ute