Getting com.google.gwt.user.client.rpc.StatusCodeException: 0 in GWT
Asked Answered
H

4

10

I sometimes/often get this Exception in GWT but don't know why:

SEVERE: com.google.gwt.user.client.rpc.StatusCodeException: 0 
java.lang.RuntimeException: com.google.gwt.user.client.rpc.StatusCodeException: 0 
    at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_Throwable_2V(Unknown Source)
    at Unknown.de_ctech24_simplynews_web_client_util_SimpleCallback_$onFailure__Lde_ctech24_simplynews_web_client_util_SimpleCallback_2Ljava_lang_Throwable_2V(Unknown Source)
    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown Source)
    at Unknown.<anonymous>(Unknown Source)
    at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)
Caused by: com.google.gwt.user.client.rpc.StatusCodeException: 0 
    at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown Source)
    at Unknown.com_google_gwt_user_client_rpc_StatusCodeException_StatusCodeException__ILjava_lang_String_2V(Unknown Source)
    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown Source)
    at Unknown.<anonymous>(Unknown Source)
    at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)

After spending some time Googling i found this: http://www.mail-archive.com/[email protected]/msg79537.html

There an interesting hint was given: it occured if you disconnect your WLAN and connect again - then the error arises. I tried this on my notebook - then the exception occurs.

Another problem is this exception arises sometimes (not really always at the same time or when executing a specific action - so seemingly random) although the network connection is fine. I don't know why this happens nor what's the correct way to handle it - sure I can catch and ignore it. But the request never goes to the server and the action is not executed - not quite a good error handling.

Some data about this app - maybe this helps narrowing or hopefully solving the problem:

  • GWT 2.4 with Sencha GXT 3.0.1
  • Occurs on all the top browsers in newest version: IE, Chrome, Firefox
  • Using Cloudflare (I also tried without it - but it's the same problem. So this seems not to be originated by using this Proxy-Service.)

Thanks a lot for every hint and every idea how to handle/solve this.

Haught answered 27/9, 2012 at 14:58 Comment(5)
How are you communicating with server-side?Priester
@PatrickMeier did you manage to solve this problem or work it around somehow? Because I'm facing quite similar situation right with no idea on how to solve or debug it...Outsize
@Yura I have not found a way to solve this problem. Sry.Haught
@PatrickMeier ahh, no problem - thanks for fast response!Outsize
In case anybody is interested, found solution to similar problem: #25036280Outsize
P
5

Since there is no HTTP status code 0, this appears not to be from the server - it could be worthwhile to test using Firebug or something, just to make sure that there isn't a bad response like this coming back.

Instead, this is almost certainly from the browser itself, either the connection timed out or was dropped by the server, or the browser couldn't reach the server (bad dns, bad gateway, lost wifi, server not available).

Treat this like any unexpected server failure - perhaps back off and try again, display a message to the user, log an error and send that when the connections are working again.

The fact that it is happening in all browsers points to a network or server issue - it is extremely unlikely that all browsers are failing in unpredictable ways together. This fact also makes it easier to debug - you can use your favorite browser's debug tools.

Prosperity answered 27/9, 2012 at 16:49 Comment(3)
You are right - as I wrote in my question it is a network issue (disconnect WLAN...) and the request is never made. But the other problem was that semmingly random requests are failing with network connection all in place.Haught
If the same thing happens in two different cases, it seems likely that those two cases are connected. Unfortunatly, without any additional debugging info, there isn't a lot I can suggest that I haven't already - watch the network traffic when these 'random' failures occur, and I think you'll detect that the server is fails to correctly respond, for network reasons or otherwise. That is what the '0' status code means in any browser I've seen it in.Prosperity
You are right. If I have more informations I come back. Thanks a lot.Haught
M
2

This happens to us if our authentication layer determines that a session has expired and redirects an RPC request to the login page on a different host. Since AJAX requests cant go to a different host, the browser aborts the request and signals status code 0. See https://code.google.com/p/google-web-toolkit/issues/detail?id=2858

Its crazy too because GWT will throw a StatusCodeException with code 0 even though the HTTP code that appears in Firebug / Chrome Inspector is clearly a 302.

Moulden answered 1/5, 2014 at 20:17 Comment(0)
M
2

Although the original poster probably had issues with their network connection I got the same error today inside GWT hosted mode. And not sometimes, but all the time.

I have now figured it out, and I'd like to share it here so other people searching for a sollution to the 0 status code problem can find it.

If you use the Rpc security tokens that GWT provides (as in this explanation: http://www.gwtproject.org/doc/latest/DevGuideSecurityRpcXsrf.html) against cross site scripting but you forget to set the security token for whatever reason then one of the things you might run into is the zero result.

I've designed my webapplication so that most RPC calls are mostly made within a framework. Today I needed to create an RPC service by hand. Forgot to set the RPCToken, got empty response from the server.

Hope this helps somebody out.

Marivaux answered 4/6, 2014 at 19:21 Comment(0)
P
1

I have found that if you hang an rpc call on the server (Thread.wait()) and the browser is refreshed then on the client side just before it loads the page again it will call the onFailure method of the waiting callback with the above mentioned status code which suggests it orginates in the client or that it is a generic error code for non-specific caught exceptions.

Photogram answered 1/11, 2014 at 23:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.