Google AppEngine and Serialization

After many researches, I found that for vaadin to work with google appengine EVERY class MUST implement the Serializable interface. The problem is that not only the classes I made should implement Serializable, but also each class I use that is in an external library. I think this is a big limitation, because I’ve no control over the libraries I use. For example I would like to use Twig Persistence in my project, but I can’t because some classes don’t implement that interface. But TwigPersistence is specifically designed to work with GAE, so there is something I don’t understand: is it required to implements Serializable because of how vaadin use each session? Is there some workaround? Also I think that it is strange to have a project in which each class must implements Serializable. Am I doing something wrong?

Thanks for the replies.

When using Vaadin on GAE, everything that is stored in a session needs to be serializable, including the Vaadin application state and anything referenced from it in non-transient fields etc. This is because GAE can serialize the session (including the application state) between any pair of requests, and e.g. serve the next request from another physical server.

If the Twig datastore instances and other related classes do not need to be preserved between requests, you could make them transient (or local variables in a method) and re-create them whenever necessary.

Just to rephrase Henri - the limitation in GAE has nothing to do with Vaadin. Everything stored in GAE session must be serializable. Thus storing data layer objects in session just leads to problems (in GAE).

Hi, I know this is an old post but I’m having currently the same issue since i want to use a 3rd party add-on on GAE(vaadin-gantt) and even if I’ve tried different approaches to surround the problem nothing has worked:

  • making the component variable transient/local in order to avoid serialization → strill tells internal classes used by the component should implement serializable

  • implenting a subclass rewritting the writeObject and readObject methods making them ignore the values of the upper-class → Same as before

-trying to convert the object to XML to “serialize” it → in fact I just read about this method but not sure if it will work due to GAE requests limitations and dind’t implement it

Can anybody give me some advice about how could I manage to use the add-on on GAE?

p.s. I know that the easiest way would be to change the source code to implement serializable but I’ve been unable to contact the author for now, and any help on the topic would be really appreciated

On GAE, everything that is in the session must be serializable - all anonymous listener classes etc.

I believe the add-on JAR also includes the source code (please check) so you could also extract it and modify it yourself. For most classes and interfaces, it is enough to add “implements Serializable” - for anonymous classes, you need to modify the superclass or inherited interface or make them not anonymous.

You might also want to consider other cloud platforms as GAE has very long latencies for stateful applications. See e.g.
Vaadin on Jelastic
) or
Vaadin on Heroku

Thanks for your reply Henri, I’ve looked inside the jar but only client classes Vxxx include the source code, I guess the author forgot to include the rest

As for the cloud service, I’m stuck with GAE due to my “project” requiriments, if not, I would have changed a long time ago :stuck_out_tongue_winking_eye:

edit: btw, is there any way to obtain contact info (like email or open id) of the developer from vaadin directory?

No more contact information available on the site than what you have already seen - also
his home page on
is empty. He should get notifications on comments for the add-on in the directory etc.

If there is no contact info inside the add-on either (check for any readme files, manifest, license files, file header comments in the client side source code etc.), a last ditch effort could be to try to use some bytecode engineering library to add the interface to the compiled classes. There even seems to be a
bytecode editor with a GUI
(disclaimer: I have never tried it).

Couldn’t find any contact info inside the package either , so I would give the java byte editor a try.

Thanks for suggesting (I would never have thought of that) I’ll posts results later on just in case someone faces the same problem

Well, I’ve been carrying various tests and I have sort of bad and good news from them

First of all, as you suggested, I could change the class files to implement Serializable and also make DateTimeFormatter variables (jodaTime) transient in order to avoid all the serializations problems.

The bad news(not related with serialization) is that the add-on makes reference to a class called ParametrizedString that I can’t find inside the package so it gives a NoClassFound error and it breaks. Searching inside the package I found that the pom file has a dependency that should adress the problem


but however, this library is not available(or I couldn’t find it ) so … the maximum I can do is paint the empty add-on.

Since I believe the ParametrizedString is used only forr tooltips , the next step is trying to change the method code to return something like “” everytime it needs that class, but … phew this is becoming a nightmare :stuck_out_tongue:

Since there is another thread talking about the add-on
I will continue my posting my results there. Many thanks for the tips Henri.

ps. The strange thing of all of this, is that there’s a demo website running perfectly and the picture of the demo seems to be using the GAE dev platform(port 8888).