soniAbhishek
soniAbhishek

Reputation: 1

GWT application running on windows and not on linux with same configuration

I am new to GWT and I am upgrading my existing GWT application to java 8 (jdk1.8.0_251) and tomcat 8(8.0.53), it is working fine on windows machine but when I tried to deploy on host linux machine with exactly same java and tomcat configuration it is giving error com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: The response could not be deserialzied

if there is GWT version incompatibility issue with java 8 or tomcat 8 it should not work in windows ? what could be the other possible reasons and where to look ? I am using following configuration

  1. GWT version 2.9.0
  2. tomcat version 8.0.53
  3. java 1.8.0.251

After investigation I found out that only Date type is not getting deserialized. Is there any specific format or date related settings for tomcat 8 ?

Upvotes: 0

Views: 90

Answers (1)

DarkScrolls
DarkScrolls

Reputation: 621

I have had this exception multiple times and it was also dependent on the server configuration/version, but it is not particularly a difference between Windows and Linux.

To make it work always, make sure that all your transfer objects (client-server) are serializable. A class is serializable if it meets these three requirements:

  • It implements either Java Serializable or GWT IsSerializable interface, either directly, or because it derives from a superclass that does.
  • Its non-final, non-transient instance fields are themselves serializable, and
  • It has a default (zero argument) constructor with any access modifier (e.g. private Foo(){} will work).

I personally like that all my DTO (Data transfer object) always implement both com.google.gwt.user.client.rpc.IsSerializable and java.io.Serializable:

public class Contact implements IsSerializable, Serializable

Also check if you the paths for translatable code (the DTO you use) are specified in the .gwt.xml file e.g.:

<source path='client' />
<source path='shared' />
<source path='server/my/special/package/pojos' />

The first two paths are there by default, but if you want to send use a specific package outside those paths it must be specified here.

Upvotes: 0

Related Questions