1

I would like to follow up on this question gwt-serialization-policy-hosted-mode-out-of-sync. In short - when I do a RPC from hosted browser then this call fails on server with the exception.

    INFO: GwtRpcEventSrvc: ERROR: The serialization policy file '/84EC7BA65AF8175BAA99B47877FDE163.gwt.rpc' was not found; did you forget to include it in this deployment?
    SEVERE: GwtRpcEventSrvc: WARNING: Failed to get the SerializationPolicy '84EC7BA65AF8175BAA99B47877FDE163' for module 'http://host:19980/MYAPP/'; a legacy, 1.3.3 compatible, serialization policy will be used.  Youmay experience SerializationExceptions as a result.
    SEVERE: Exception while dispatching incoming RPC call

While when I do the same RPC from browser then the request is performed successfully on server.

In addition I observed a strange behavior of GWT compiler that could result in a problem with hosted browser mode.

I assume when I do two subsequent compilations of an exact same code then the result of the individual compilations is supposed to be same. I mean at least the xxxxx.html and yyyyy.gwt.rpc files have to be same. (Where xxxxx and yyyyy are the long numbers such as 84EC7BA65AF8175BAA99B47877FDE163.)

Currently I have two versions of my project.

  • An old project compiled by GWT 1.7 that does not suffer from problem with the hosted browser described in gwt-serialization-policy-hosted-mode-out-of-sync
  • A new project that is compiled by GWT 2.0.4. This new project is based on the old project. This project suffer from the hosted browser problem.

Case 1: Old project with GWT 1.7

I took my old project that was compiled by GWT 1.7. I did two compilations and I compared compilation artifacts. gwt.rpc files were same while html files had different content and name. Since the gwt.rpc files were alwas same I did not have a problem with hosted browser.

Case 2: New project with GWT 2.0.4

I compiled it twice and both gwt.rpc and html files were different. Therefore RPC call in hosted browser failed on server because of missing gwt.rpc file.

Case 3: Old project with GWT 2.0.4

I compiled it twice and both gwt.rpc and html files were different. Therefore RPC call in hosted browser failed on server because of missing gwt.rpc file.

I did some investigation and identified that when I comment out a data member in a class Data that is transmitted from server to client, then compiled files start being same.

    class Data implements IsSerializable {
           List<IsSerializable> data;
           ...
    }
  1. I wanted to do same thing in the new project but it seems that there are many classes to be modified. So the problem is growing as the project is growing.
  2. I don't know what to use instead of

    List<IsSerializable> data;
    

    to transfer data.

Community
  • 1
  • 1
Vitek
  • 71
  • 5

1 Answers1

0

You need to read some more on GWT serialization policies:

Serializable Types

Usually you don't mingle with .rpc files unless your are doing advanced RPC calls directly to your server.

Your serializable object :

class Data implements IsSerializable {
      List<IsSerializable> data;
       ...
}

A user-defined class is serializable if all of the following apply: It is assignable to IsSerializable or Serializable, either because it directly implements one of these interfaces or because it derives from a superclass that does All non-final, non-transient instance fields are themselves serializable, and As of GWT 1.5, it must have a default (zero argument) constructor (with any access modifier) or no constructor at all.

So you should probably have something like:

class Data implements IsSerializable {
      List<YOUR_TYPE> data;
       ...
}

Your list's template is a type, you don't set 'IsSerializable'... it should be something like :

List<int> data;
code-gijoe
  • 6,949
  • 14
  • 67
  • 103