Friday, November 22, 2013

Re: IncompatibleRemoteServiceException after new deployment


The server's log showed a SerializationExeption (see below): The enum AnnouncementType was not assignable to IsSerializable.

And indeed, AnnouncementType was not implementing IsSerializable, that's correct. But this code is running for years.
Why does this exception occurr now?

Because you have updated your server side code while you have used your app in the browser. This exception could have occurred all the years while your app is running. Maybe you were just lucky that you have never deployed your app while anyone is using it.

Your log file should also have a warning, something like "Could not find serialization policy file ..... falling back to legacy GWT 1.3 serialization..." (the exact wording is likely different). This warning only occurs once when the first server request has been made.

Once GWT is in that GWT 1.3. serialization mode on your server then it expects classes to implement IsSerializable but an enum implements java.io.Serializable. If GWT is not in that legacy 1.3 mode it also understands java.io.Serializable. But GWT only allows java.io.Serializable classes that are white listed in the <hash>.rpc file and if that file can not be found on the server you get the above warning and finally the error you have posted.

I would recommend to always use java.io.Serializable instead of IsSerializable. Because if you do so all your serializable classes will fail to work if anything is wrong with the <hash>.rpc file. If you mix both then IsSerializable classes will work even if something is wrong with your <hash>.rpc file. In this case you only get errors when you hit a class that implements Serializable but not IsSerializable (like an enum).

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment