jcricket / gwt-syncproxy

Provides Synchronous and Asynchronous access to GWT-RPC servlets from Java and Android
http://www.blueesoteric.com/open-source/gwt-syncproxy
Apache License 2.0
23 stars 14 forks source link

not working with GWT 2.2.0 #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use syncproxy with GWT 2.2.0 project in server

What version of the product are you using? On what operating system?
MAC OS - GAE 1.4.2 & GWT 2.2.0 - eclipse

Error:
Caused by: com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: 
This application is out of date, please click the refresh button on your 
browser. ( Expecting version 6 from server, got 7. )

This was hap with old project with new GWT too..i changed lib jars n it worked. 
Might do the trick.

Please provide any additional information below.

Original issue reported on code.google.com by srinivas...@gmail.com on 23 Mar 2011 at 5:42

GoogleCodeExporter commented 9 years ago
I make it work by comment following line 359:

// serializationPolicy.validateDeserialize(instanceClass);

Original comment by new.r...@gmail.com on 8 Apr 2011 at 2:18

GoogleCodeExporter commented 9 years ago
Hi
this is because of the inheritance of final members, when these are used on 
runtime the >compile time< inherited values are used, instead of the Runtime 
values!

the solution is to use reflection in the class loading to reflect the GWT 
engine avaliable at run time 

here is a piece of code to paste at head of the 
AbstractSerializationStreamReader class:
public class SyncClientSerializationStreamReader extends 
AbstractSerializationStreamReader {

    public static int SERIALIZATION_STREAM_VERSION;//used for cross gwt version compatibility as the compiled file imports the GWT version directly into the file
    public static int SERIALIZATION_STREAM_MIN_VERSION;
    //public static char RPC_SEPARATOR_CHAR;

    static {
        try {
            SERIALIZATION_STREAM_VERSION = AbstractSerializationStreamReader.class.getField("SERIALIZATION_STREAM_VERSION").getInt(null);
            SERIALIZATION_STREAM_MIN_VERSION = AbstractSerializationStreamReader.class.getField("SERIALIZATION_STREAM_MIN_VERSION").getInt(null);
            //RPC_SEPARATOR_CHAR=AbstractSerializationStreamReader.class.getField("RPC_SEPARATOR_CHAR").getChar(null);
        }
        catch (Exception e) {
        }
    }

==============================
another piece of code you might want to replace is at the prepareToRead method:
the updated method allow the use of versions between the 
MIN_SERIALIZATION_VERSION & SERIALIZATION_VERSION while the original only 
allowed SERIALIZATION_VERSION

   public void prepareToRead(String encoded) throws SerializationException {
        parse(encoded);
        index = results.size();
        super.prepareToRead(encoded);

        if (getVersion()<SERIALIZATION_STREAM_MIN_VERSION ||
                getVersion() >SERIALIZATION_STREAM_VERSION) {               
                    throw new IncompatibleRemoteServiceException("Expecting version between "
            + SERIALIZATION_STREAM_MIN_VERSION + " and "
            + SERIALIZATION_STREAM_VERSION + " from client, got " + getVersion()
            + ".");
        }

        buildStringTable();
    }

Roi Rosenthal

Original comment by roi...@gmail.com on 28 Aug 2011 at 12:13

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r52.

Original comment by gwtdevel...@gmail.com on 30 Aug 2011 at 12:21