Search code examples
javagwtserializationgwt-rpcgwt-platform

GWT RPC not generating a proper gwt.rpc file


I am using gwt with gwt-platform and making a server call with the dispatch async. The issue I am running into is that the Action that I am using is not being marked as serializable or being added to the *.gwt.rpc file. When my code run I get a

com.google.gwt.user.client.rpc.SerializationException at com.google.gwt.user.client.rpc.impl.SerializerBase.getTypeHandler(SerializerBase.java:153) at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:125) at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:183) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126) at com.gwtplatform.dispatch.shared.DispatchService_Proxy.execute(DispatchService_Proxy.java:33) at com.gwtplatform.dispatch.client.DefaultDispatchAsync.serviceExecute(DefaultDispatchAsync.java:126) at com.gwtplatform.dispatch.client.DefaultDispatchAsync.execute(DefaultDispatchAsync.java:...

The Action:

public class FindCallsWithFilterAction extends UnsecuredActionImpl<FindCallsWithFilterResult> {

public FindCallsWithFilterAction() {

}

public Date getAfter() {
    return after;
}
public Date getBefore() {
    return before;
}
public Long getReferenceNumber() {
    return referenceNumber;
}
public String getUser() {
    return user;
}

public void setAfter(Date after) {
    this.after = after;
}
public void setBefore(Date before) {
    this.before = before;
}
public void setReferenceNumber(Long referenceNumber) {
    this.referenceNumber = referenceNumber;
}
public void setUser(String user) {
    this.user = user;
}

public boolean hasAfter(){
    return null != after;
}
public boolean hasBefore(){
    return null != before;
}
public boolean hasReferenceNumber(){
    return null != referenceNumber;
}
public boolean hasUser(){
    return null != user;
}


private Date after = null;
private Date before = null;
private Long referenceNumber = null;
private String user = null;

}

The Action has result and a Handler and the handler is bound in my server module. When I debug the code and look at the Serialization map that gwt generates this action and its result aren't there event though this implements the isSerializable interface (in the super class, it still doesn't work if I use Serializable or isSerializable at this level either). Also when I look into my *.gwt.rpc file the class is not in there either. I'm just stuck and was hoping some one would know what to do or what was wrong.

Update: I don't know if it is relevant but I am using spring on the server.


Solution

  • I found my problem. I had forgotten a no-arg constructor in my Result object, also I was using a Builder to create my action and for some reason that was causing the serialization issue once I stopped using the Builder pattern everything ran smoothly.