Re: Serialization problem using CustomFieldSerializer(s) and specifying specific .java files in gwt module xml
I had something similar using GWT2.0 and GAE plugin in Eclipse. I was using a custom serializable object (UserContext) which was holding a reference to SetString. I was working ok for awhile then suddently stopped working. After reviewing all items that was introduced since the last time it was working, I finally made it work using a custom launch for my Hosted application. Here my analysis of the problem: Last time it was working, I was using GAE lauching facility with the embedded server. GAE uses the new Hosted mode startup program in this case. I soon as you setup GAE launching with noserver to true, it starts the application in the old mode. I was providing all the necessary rpc files for server side by first compiling the code making sure to generate the files under my WebContent folder of eclipse before deployment under my local Oracle 10g instance. Starting the hosted mode application using GAE was giving me the problem all the time. I then forces GAE hosted mode to store generated stuff under WebContent but the folder used in this case was not right. Looking both rpc checksum entries from the compile version versus Hosted mode generated version, I realized that the checksum for the Set was different! I then setup a Java launch with all the dependencies (cut and paste + some tailoring of the GAE launch xml file found in the workspace) to use the new Hosted mode + the parameter to store generated stuff under WebContent and it is now working again. No need to GWT compile anymore since the hosted mode will generate the file under the correct folder. No sure of the exact root cause but it looks to me that the old hosted mode does not compile the rpc file the same way! On Oct 3, 11:14 pm, Andrius Juozapaitis andri...@gmail.com wrote: Hey, I've been trying to emulate parts of 3rd party library and stumbled upon a problem. The library has certain classes with java.lang.Object references that I wanted to get rid of, and I want the classes to implement java.io.Serializable. The package structure is like that: -java/dao/ -EntityWithObjectReference.java -EntityWithObjectReference_CustomFieldSerializer.java -ExtendedEntity.java -resources/ serialization.gwt.xml -substituted.dao/ EntityWithObjectReference.java Everything is built using maven, so files end up where they should be. Original base entity class I want to emulate: package dao; public class EntityWithObjectReference { public Object objReference; private String text; public String getText() { return text; } public void setText(String text) { this.text = text; } } Emulated base entity class (implements serializable, Object ref removed): package dao; import java.io.Serializable; public class EntityWithObjectReference implements Serializable { private String text; public String getText() { return text; } public void setText(String text) { this.text = text; } } The class I actually use in both client and server side: package dao; import java.io.Serializable; public class ExtendedEntity extends EntityWithObjectReference implements Serializable { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } There's also a EntityWithObjectReference_CustomFieldSerializer.java, which simply ignores the Object reference for now: package dao; import com.google.gwt.user.client.rpc.*; public class EntityWithObjectReference_CustomFieldSerializer { public static void serialize(SerializationStreamWriter writer, EntityWithObjectReference entity) throws SerializationException { writer.writeString(entity.getText()); } public static void deserialize(SerializationStreamReader reader, EntityWithObjectReference entity) throws SerializationException { entity.setText( reader.readString()); } } Now, if I just leave the source element empty (it should include all the java files in the package), everything works fine, serialization works as expected, and custom serializer is being called. serialization.gwt.xml: module inherits name=com.google.gwt.core.Core/ source path=dao !--include name=ExtendedEntity.java/-- !--include name=EntityWithObjectReference.java/-- /source super-source path=substituted/ /module ***When I try to uncomment the two lines*** that explicitly include the specific java files (I need that because the original library I want to emulate has a number of additional files in the source packages that gwt doesn't ever need to know about), there's a problem - GWT keeps complaining that 'This application is out of date, please click the refresh button on your browser'. The server response is the same in both cases: //OK[3,2,1,[dao.ExtendedEntity/1266011518,xxx,evil entity],0,5] But GWT generated
Serialization problem using CustomFieldSerializer(s) and specifying specific .java files in gwt module xml
Hey, I've been trying to emulate parts of 3rd party library and stumbled upon a problem. The library has certain classes with java.lang.Object references that I wanted to get rid of, and I want the classes to implement java.io.Serializable. The package structure is like that: -java/dao/ -EntityWithObjectReference.java -EntityWithObjectReference_CustomFieldSerializer.java -ExtendedEntity.java -resources/ serialization.gwt.xml -substituted.dao/ EntityWithObjectReference.java Everything is built using maven, so files end up where they should be. Original base entity class I want to emulate: package dao; public class EntityWithObjectReference { public Object objReference; private String text; public String getText() { return text; } public void setText(String text) { this.text = text; } } Emulated base entity class (implements serializable, Object ref removed): package dao; import java.io.Serializable; public class EntityWithObjectReference implements Serializable { private String text; public String getText() { return text; } public void setText(String text) { this.text = text; } } The class I actually use in both client and server side: package dao; import java.io.Serializable; public class ExtendedEntity extends EntityWithObjectReference implements Serializable { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } There's also a EntityWithObjectReference_CustomFieldSerializer.java, which simply ignores the Object reference for now: package dao; import com.google.gwt.user.client.rpc.*; public class EntityWithObjectReference_CustomFieldSerializer { public static void serialize(SerializationStreamWriter writer, EntityWithObjectReference entity) throws SerializationException { writer.writeString(entity.getText()); } public static void deserialize(SerializationStreamReader reader, EntityWithObjectReference entity) throws SerializationException { entity.setText( reader.readString()); } } Now, if I just leave the source element empty (it should include all the java files in the package), everything works fine, serialization works as expected, and custom serializer is being called. serialization.gwt.xml: module inherits name=com.google.gwt.core.Core/ source path=dao !--include name=ExtendedEntity.java/-- !--include name=EntityWithObjectReference.java/-- /source super-source path=substituted/ /module ***When I try to uncomment the two lines*** that explicitly include the specific java files (I need that because the original library I want to emulate has a number of additional files in the source packages that gwt doesn't ever need to know about), there's a problem - GWT keeps complaining that 'This application is out of date, please click the refresh button on your browser'. The server response is the same in both cases: //OK[3,2,1,[dao.ExtendedEntity/1266011518,xxx,evil entity],0,5] But GWT generated javascript expects a different checksum in this case, and an exception is raised when deserializing the data. Any ideas why this is happening? Bug, feature, a bit of both? I'd be more than happy to supply the code to verify this behavior, if anyone can help me sort this out. regards, Andrius J. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---