De-serialization with GAE

I’m still quite new to Vaadin, so I work through the tutorial. Up to now, everything worked fine, I was able to run the application both in my local Eclipse and on GAE.

However, now that I reached the end of
section 5.4
, I cannot use the save button on that form anymore. The application says the session was expired, and of course there is an exception in the log:


com.vaadin.terminal.gwt.server.GAEApplicationServlet getApplicationContext: Could not de-serialize ApplicationContext for 8TghSamsywihN70vPK_iYw A new one will be created. 
java.io.StreamCorruptedException
	at java.util.Hashtable.reconstitutionPut(Hashtable.java:906)
	at java.util.Hashtable.readObject(Hashtable.java:878)
	...

Where does that come from? Or, how can I find the spot? All my classes are serializable, of course. Perhaps some constituent isn’t, but I cannot get that information from the stack trace.

I’ve been running into this as well. Happened to me a couple of months ago, couldn’t diagnose it, but after a large refactoring it mysteriously went away. Now it’s back and I’m still unable to figure out what is going on. The StreamCorruptedException occurs following an IllegalStateException. Any help would be appreciated. It happens when several windows are added to the main window.

Sep 27, 2011 1:14:46 PM com.vaadin.terminal.gwt.server.GAEApplicationServlet getApplicationContext
WARNING: Could not de-serialize ApplicationContext for np8gfaivzesn A new one will be created.
java.io.StreamCorruptedException
at java.util.Hashtable.reconstitutionPut(Hashtable.java:889)
at java.util.Hashtable.readObject(Hashtable.java:861)
at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

Sep 27, 2011 1:14:46 PM com.vaadin.terminal.gwt.server.GAEApplicationServlet service
WARNING: An exception occurred while servicing request.
java.lang.IllegalStateException
at org.mortbay.jetty.servlet.AbstractSessionManager$Session.getMaxInactiveInterval(AbstractSessionManager.java:849)
at com.vaadin.terminal.gwt.server.GAEApplicationServlet.service(GAEApplicationServlet.java:254)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

Just a bit more color. Mine is a GAE application as well. I’m using Vaadin 6.6.6 with jdk1.6.0_27, app engine java sdk 1.5.3, gwt sdk 2.4.0.

This is a frustrating issue to work out because you don’t get any useful information to try to figure out the problem. However, in my case it had something to do with the hashcode of an object not being the same before serialization and after de-serialization. I had to overhaul my custom hashCode and equals methods (and compareTo because equals used compareTo) and this solved the problem.

If you’re using Eclipse, you can set a Java Exception Breakpoint to stop right before the StreamCorruptedException and analyzing the state there can give you some insight into where the problem is coming from.