java.io.NotSerializableException

Hi: Gurus I am having the following errors when executing a Vaadin application

Cannot serialize session attribute com.vaadin.terminal.gwt.server.WebApplicationContext for session 3947DC658051DAAA2BC1EEE29E1EB1EA
java.io.NotSerializableException: oracle.jdbc.driver.LogicalConnection

The error is very sporadic but happens quite often. Besides this the behavior of Vaadin application is bit weird on Safari and Opera and it throws me the following exception on the browser window when I try to access the application

java.lang.NullPointerException
com.vaadin.data.util.QueryContainer.refresh(QueryContainer.java:170)

Any insider can shed some light, please.

The server you’re using is trying to serialize the session, but you’re using some stuff that’s not serializable (i.e not Vaadin specific - Vaadin itself is serializable). This is only a problem if you actually want to serialize your session, in which case you’ll have to arrange so that the server does not try to serialize the non-serializable stuff.

Are you saying it only throws this exception when using Safari or Opera? …that’s weird because that’s an exception from the server-side, and I can’t really see how it would be browser-dependent - the reason must be somewhere else, but with this amount of information, I can’t even guess.

Best Regards,
Marc

Marc no I am not using any stuff that requires serialization. I am just using JNDI to get hold of of a connection from pooled data source and passing that connection to the query container that I binds later to a Table or Tree component. E.g

verticalLayout.addComponent(new Table(“Employee”, SomeDataContainer.getInstance().getUserCotainer()));

Code inside the getUserCotainer() looks like this

conn = GetJDBCConnection.getInstance().getConnection();
queryContainer = new QueryContainer(“SELECT * FROM ERES.ER_USER where USR_LOGNAME is not null”, conn);

I am bit side tracking but I also need to know that once you passed the connection to QueryContainer, who is responsible for closing the connection, QueryContainer or the client code. In case of client code do you recommend any design pattern?

My bad, this is no issue. Let me explain you what happened. My natural course of testing the application is FireFox, IE, Opera and Safari. It is just a coincidence that before I reached to Opera and Safari was about time the above exception had thrown by the container and I got the error back from the server. The reason I got confused is that when I go back to the formal two browsers and accessed the application there was no error (probably Vadding uses browser cache to show the already rendered page, correct me if I am wrong) , when I clear the old cache and access the application from IE and Firefox once the container threw the above exception, I got the same error.

Regards,
Rashid.

Your server is trying to serialize your session, but the connection you mention can not be serialized; you need to avoid this either by not serializing at all (server config), or by arranging so that the connection is not serialized (transient).

Best Regards,
Marc