Wednesday, July 19, 2017

Re: SerializationException when application is modified

On Tuesday, July 18, 2017 at 6:15:23 PM UTC+2, Óscar Frías Barranco wrote:

When we modify the code of our GWT application, in particular the classes that travel through GWT calls, these exceptions are generated for many users for a few hours: Type '.....' was not assignable to '' and did not have a custom field serializer.For security purposes, this type will not be serialized.: instance = .....

We think that this is due to browsers caching the previous (old) code which is no longer aligned with the server code.  We have reviewed all HTTP headers related to caching and all of the are, we think, correctly configured.

So our plan is to force a reload of the browser page with a location.reload(true) when we detect that the SerializationException is being thrown at the server.

From a UX point of view, it's probably better to show an error (possibly with a button to reload the app) than forcibly reload, as that could possibly lead to losing data the user has entered.
This is what Google Groups is doing, and it allows users to copy their message before reloading, pasting and re-sending it.
Any ideas about how to implement this easily?  Our code if full of AsyncCallback calls and we would like to avoid editing each one of them.  Is there a place where we could insert a client code that would be executed for every RPC call and that will call location.reload(true) if a SerializationException is thrown ?

If your GWT.create() for the services are relatively centralized, you could implement wrappers that wrap the AsyncCallback before delegating to the real service.

I.e. from 

FooServiceAsync fooService = GWT.create(FooService.class);


FooServiceAsync fooService = new FooServiceAsyncWrapper();


class FooServiceAsyncWrapper implements FooServiceAsync {
  private final FooServiceAsync delegate = GWT.create(FooService.class);

  public void doFoo(int param1, String param2, AsyncCallback<Bar> callback) {
    delegate.doFoo(param1, param2, new AsyncCallbackWrapper<Bar>(callback));

class AsyncCallbackWrapper<T> implements AsyncCallback<T> {
  private final AsyncCallback<T> delegate;

  public AsyncCallbackWrapper(AsyncCallback<T> delegate) {
    this.delegate = delegate;

  public void onSuccess(T result) {

  public void onFailure(Throwable caught) {
    if (caught instanceof Xxx) {
      // handle failure
    } else {

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment