Not Serializable error using external jars

Using MongoDB and Tomcat.
Following exception is reported:


Jun 9, 2012 4:15:46 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name 
[/ourEmr] has started
Jun 9, 2012 4:15:46 PM org.apache.catalina.session.StandardSession writeObject
WARNING: Cannot serialize session attribute com.vaadin.terminal.gwt.server.WebApplicationContext for session 734068FB23ABBA862EA6F742496B0849
java.io.NotSerializableException: com.mongodb.DBApiLayer
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)

How to work with third party libraries?
Thanks for help!

While working with non-Serializable-objects, you need to implement the writeObject()- and readObject()-methods. Check any tutorial about Serialization for details.

This is more of an Tomcat-requirement than one of Vaadin, as the Tomcat tries to serialize its Sessions for keeping them across Server-restarts.

And to continue on Tobias’ reply: see e.g.
this blog post
for instructions to disable session persistence in Tomcat. It is often a good idea to disable it in your development environment anyway, and in production environments the exception would just lead to sessions not being preserved over server restart.