Avoid NotSerializableException in development

Hi,

my situation is this (in short): I’m creating an application which starts with a servlet and forwards to the Vaadin part in the next step. Within the non Vaadin part an user object is stored in the
HttpRequest
so I’m able to access this object within my Vaadin UI (it’s authorization stuff).

This works fine. But the user object is not serializable so every time I change my code in development I get
NotSerializableExceptions
- so I can’t work with the application without server restart. And that’s annoying…

Unfortunately there is no way to implement
Serializable
because I’m not in charge for the authorization code.

Do you have any suggestions how to handle this?

Thanks, Thorsten

••••••••••
Eclipse 3.5.1 • Vaadin 6.2.6 • Vaadin Eclipse Integration 1.2.0 • Java 1.5
Windows XP/2000 • IE6/7 • Tomcat 6.0

If this is just an annoyance from the delelopment point of view -
turn of serialization in your servlet container
.

If you want to keep the serialization, mark user object to be transient and implement serialization yourself (save the user id for example instead of the user object itself).

Hi Joonas,

I am also getting similar error. What i did is I made my service class Serializable.

But I want to know,
What is the proper (or preferred) solution?
I don’t mind implementing Serializable, but is it gonna harm OR gonna bring new stuff in any way?

I mean I have service class say EmployeeService class, which is singleton (Spring injected) , Is there any problem with making it Serializable?

Cheers

I would not implement Serializable
if
there is no functional or scalability requirements for it. Instead - I would just turn off the serialization from the server.