Did you exclude your upload servlet from struts.xml ? By default struts intercepts all multi part requests and this messes a lot specially when you have hybrid framework when few modules are plain j2ee and few are struts 2 or Spring MVc in the same app.
Are you upload less than 2gb file ? On Monday, January 18, 2016, Christopher Schultz < ch...@christopherschultz.net> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Rahul, > > On 1/17/16 11:28 PM, Rahul Singh wrote: > > Code flow is attached, forgot to attach in trailing mail. > > > > ---------------------------------------------------------------------- > - -- > > > > > *From:* Rahul Singh <rksing...@hotmail.com <javascript:;>> > > *Sent:* Monday, January 18, 2016 8:39 AM *To:* Tomcat Users List > > *Subject:* Re: File size >= 2GB not uploaded in application > > [Tomcat 7.0.54 Struts: 2.3.24 JAVA: openJDK 1.7.79] > > > > Hello Christopher, thanks for your prompt response !! > > > >> Why didn't you come to the Tomcat community first? > > Sorry for the delay, we wanted to make sure about the component > > causing the problem. > > > > > >>> I don't have a test-case in front of me, but I'm fairly > >>> confident that Tomcat allows file uploads of greater than 2GiB. > >>> I suspect the problem > > is another component. > >>> Are you using Servlet 3.0-based file upload, or are you > >>> allowing Struts to handle the file-upload for you? If you use > >>> Servlet-3.0 file-upload, then you'll have code that deals with > >>> Multipart classes and configuration in web.xml. If you are > >>> using Struts's file-upload, then you'll mostly just be calling > >>> getFile or getInputStream or however Struts 2 does things (I > >>> can't remember how it all works off the top of my head). > > > > > > In our case the filter class implements the javax.servlet.flter > > and imports javax.servlet.* The Filter class mentioned in the > > previous threads is the first one as declared in the web.xml > > (followed by other struts filters). All (url) requests are mapped > > to this filter. So this is where our file upload request goes. It > > is only in greater than 2 gb file upload request that the > > dofilter() fails to get any request. So we feel servlet 3.0 being > > used in our case the Filter is not being able to handle greater > > than 2 gb requests. > > > > > >>> The point is, if you are using Struts, then Tomcat will not > >>> touch the request and Struts is handling the whole thing. If > >>> Struts is the problem, you'll need to talk to the Struts > >>> team[1]. > > > >>> If you are using Servlet-3.0 file-upload, then Struts is just a > >>> red herring and this is the right place to get your issue > >>> solved. > > > > As mentioned above Servlet 3.0 is being used. So request the > > tomcat community to please look into our issue. > > > >>> So far, you have posted some configuration for Struts and some > >>> JSP tablib-filled code, plus some Java code for a Filter. You > >>> didn't say where the Filter was in the filter chain (before or > >>> after Struts filter). You also mentioned that the form is > >>> actually posted using XMLHttpRequest and not through a standard > >>> form, but you didn't explain what component is doing that or > >>> how it actually works. > > > >>> There isn't enough information here to make any sense of the > >>> situation. Can you please address all of the questions I've > >>> posed above and maybe we can then help you? > > > > > > <<<Code model >>>> We need to model the following code to be told: > > jsp submit of the form How the .js submit it further in > > XmlHttpRequest How the Filter is declared How the web.xml is > > declared > > > > > >> Are you sure the request is even made to the server in these > >> cases?What if the Javascript upload component is failing before > >> it even starts? > > > > Yes the request is made in these cases. We have compared the > > scenario for greater than 2gb and lesser size file uploads and > > drawn the following inference from it.We have checked the request > > and content length for dofilter() method in our logs. The > > JavaScript is not the culprit in this case. The JavaScript sets the > > AJAX field to success after sending request and thereafter waits > > for response(which is not received in our case). Our application > > works fine for lesser than 2 gb fie uploads but fails for greater > > size files as the request fails to reach the dofilter() method > > after which the request can be forwarded to the requested method. > > > > > > > > Regards, Rahul > > > > ________________________________________ From: Christopher Schultz > > <ch...@christopherschultz.net <javascript:;>> Sent: Saturday, January > 16, 2016 > > 9:33 AM To: Tomcat Users List Subject: Re: File size >= 2GB not > > uploaded in application [Tomcat 7.0.54 Struts: 2.3.24 JAVA: openJDK > > 1.7.79] > > > > Rahul, > > > > On 1/15/16 1:02 AM, Rahul Singh wrote: > >> Thanks for your guidelines, we have big hope from Apache Tomcat > >> Team to solve this problem as this is show stopper for our > >> application, we have also raise this question on various forum > >> like stack overflow and other, but no relevant reply till now. > > > > Why didn't you come to the Tomcat community first? > > > >> Hope you understand my situation, > > > >> please refer the below stackoverflow reference for more detail > >> about this issue. > > > >> http://stackoverflow.com/questions/34783438/dofilter-fails-to-get-any > - - > > > >> > <http://stackoverflow.com/questions/34783438/dofilter-fails-to-get-any-> > > doFilter() fails to get any request for the file upload > 2gb > > <http://stackoverflow.com/questions/34783438/dofilter-fails-to-get-any > - -> > > > > > stackoverflow.com > > For my struts project the doFilter() fails to get any request from > > the file upload form in cases the size of the file is greater than > > 2gb. Below is the code fragment: Filter (class is FilterUp) is... > > > > > > > > request-for-the-file-upload-2gb?noredirect=1#comment57315528_34783438 > > > > > > > > > > for more information: > > > >> -No error are printed in tomcat logs. - how to configure "call > >> HttpServletRequest.getHeader("Content-Length") as a String and > >> parse it yourself." > > > > I don't have a test-case in front of my, but I'm fairly confident > > that Tomcat allows file uploads of greater than 2GiB. I suspect the > > problem is another component. > > > > Are you using Servlet 3.0-based file upload, or are you allowing > > Struts to handle the file-upload for you? If you use Servlet-3.0 > > file-upload, then you'll have code that deals with Multipart > > classes and configuration in web.xml. If you are using Struts's > > file-upload, then you'll mostly just be calling getFile or > > getInputStream or however Struts 2 does things (I can't remember > > how it all works off the top of my head). > > > > The point is, if you are using Struts, then Tomcat will not touch > > the request and Struts is handling the whole thing. If Struts is > > the problem, you'll need to talk to the Struts team[1]. > > > > If you are using Servlet-3.0 file-upload, then Struts is just a > > red herring and this is the right place to get your issue solved. > > > > So far, you have posted some configuration for Struts and some JSP > > tablib-filled code, plus some Java code for a Filter. You didn't > > say where the Filter was in the filter chain (before or after > > Struts filter). You also mentioned that the form is actually > > posted using XMLHttpRequest and not through a standard form, but > > you didn't explain what component is doing that or how it actually > > works. > > > > There isn't enough information here to make any sense of the > > situation. Can you please address all of the questions I've posed > > above and maybe we can then help you? > > > > Are you sure the request is even made to the server in these > > cases? What if the Javascript upload component is failing before it > > even starts ? > > > > -chris > > > > [1] http://struts.apache.org/mail.html > > > >> ________________________________________ From: Christopher > >> Schultz <ch...@christopherschultz.net <javascript:;>> Sent: Thursday, > January > >> 14, 2016 8:43 PM To: Tomcat Users List Subject: Re: File size >= > >> 2GB not uploaded in application [Tomcat 7.0.54 Struts: 2.3.24 > >> JAVA: openJDK 1.7.79] > > > >> André, > > > >> On 1/14/16 5:02 AM, André Warnier (tomcat) wrote: > >>> I have not followed this thread in details, but did you check > >>> this : > >>> > >>> http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Common_Attr > i > > > >>> > butes > >>> > >>> > >>> > > --> maxPostSize > > > >> +1 > > > >>> The maximum size in bytes of the POST which will be handled by > >>> the container FORM URL parameter parsing. The limit can be > >>> disabled by setting this attribute to a value less than zero. > >>> If not specified, this attribute is set to 2097152 (2 > >>> megabytes). Note that the FailedRequestFilter can be used to > >>> reject requests that exceed this limit. > >>> > >>> Note: the size above might relate to the *encoded* size of the > >>> file, as it is transmitted over the WWW (possibly encoded as > >>> Base64 e.g.), which may mean that an original 1 MB file > >>> translates to more than 1 MB bytes while being uploaded. > >>> > >>> Note also : maybe "Struts" is setting this to some other > >>> default value.. > >>> > >>> Another question : did you check the Tomcat logs ? > > > >> IIRC, Tomcat doesn't log anything in these cases. You have to > >> use the FailedRequestFilter to detect and report the condition. > >> I wouldn't use that Filter in productio, but it would be good as > >> a simple test to see if this is the error that is occurring. > > > >> When Tomcat refuses to allow a file upload that it too large, it > >> simply does not parse the parameters, but the request continues > >> to process as usual (but the servlet doesn't end up getting any > >> of the parameters). I'm surprised that Struts isn't getting the > >> request in these cases. > > > >> -chris > > So... what makes you sure that the browser actually made the request? > I'd like to see some kind of confirmation using a tool you didn't > write. Perhaps something like Firebug, LiveHttpHeaders, Fiddler, or > even Wireshark showing that the request was made, what headers it had, > etc. > > - -chris > -----BEGIN PGP SIGNATURE----- > Comment: GPGTools - http://gpgtools.org > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iEYEARECAAYFAlacfGwACgkQ9CaO5/Lv0PDZ9wCgk9toUxcJpCosg5Nx5sKDF6lB > MQ4AnimyBJlk2kFmNj/Kiolfd8WQUYLR > =TuoH > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org <javascript:;> > For additional commands, e-mail: users-h...@tomcat.apache.org > <javascript:;> > >