Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT IllegalArgumentException: encodedRequest cannot be empty

Tags:

encoding

gwt

I am using gwt1.5, struts2, spring and hibernate. I am getting following error:

ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/project name] - Exception while dispatching incoming RPC call java.lang.IllegalArgumentException: encodedRequest cannot be empty

This error only occurs with IE, but it is working perfectly in FireFox.

like image 442
usman Avatar asked Jul 31 '09 06:07

usman


2 Answers

I've done a lot of research into this over the past couple of months - before I get into the details, my web application is using GWT 2.x running on Tomcat 7, with an Apache httpd 2.2.x and mod_jk 1.2.x setup in front.

With mod_jk version 1.2.26, I'd occasionally see the 'encodedRequest cannot be empty' error in the logs. Like the question says, this would only happen in IE, for me only IE8/9. The problem is that my server OS is Linux, so there's no way that NTLM authentication could be the issue. In newer versions of mod_jk (1.2.37 at this writing), I would instead get a socket timeout and read error in the Tomcat logs.

This error would be logged during a polling of my web application to the server every few seconds in order to get the status of a long-running operation that had been launched in a separate thread. The polling would happen every five seconds, but occasionally it would hang while doing this status request.

After a lot of tcpdump commands, I found that the request that hung would come on a TCP connection that was being reset by Apache; a FIN/ACK was being sent to the browser, the POST request header and body would be received by the server, and the server would continue to reset the connection. Then, strangely enough, only the header would come back to the server from the browser. After researching a little, I found this:

Why does Internet Explorer not send HTTP post body on Ajax call after failure?

Apparently, IE will only send the headers during the re-send of the POST request. In true Microsoft fashion, this issue has actually been know about for a while, a hotfix was issued and installed, but NOT ENABLED on the client machine. If you don't want to force all of your users to edit their registry, you need to either disable HTTP Keep-Alive on your server or increase the Keep-Alive timeout to > 60 seconds. For my apache httpd server, I'm setting KeepAliveTimeout to 65 and MaxKeepAliveRequests to 0 so that the server doesn't initiate connection resets to the browser.

like image 84
Chris P. Avatar answered Oct 07 '22 17:10

Chris P.


This seems to be a proxy issue where the proxy server is stripping out the body of the request, see here.

Furthermore, from what I have experienced this issue only seems to occur when using IE7.0 and not IE6.0

like image 41
Clinton Bosch Avatar answered Oct 07 '22 19:10

Clinton Bosch