NotSerializableException on serialization of objects currently shown by Vaa

I get a NotSerializableException when I want to serialize an Object that is currently shown by Vaadin.

The structure is like this:

Vaadin UI <— serialize / deserialize — > Hibernate/JPA Postgres Database

Vaadin shows objects that are requested from the Database via IPC, but when I manipulate the object and want to save it again by serializing it and sending it over to the controller I get the following Exception:

java.io.NotSerializableException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
    at java.util.LinkedList.writeObject(LinkedList.java:1118)
    at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
...

I tried to:

Request → manipulate → Save | works

Request → show in Vaadin → manipulate in Vaadin-> Save | doesn’t work

Why does the Serializer want to AnnotationConfigEmbeddedWebApplicationContext and is there a workaround? Can I remove it beforehand?

The Post is still 8 months old… I try to reanimate it…

We have the same Issue and want to serialize our Sessions.
Here are some more debug Infomation:


java.io.NotSerializableException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext

- custom writeObject data (class “java.util.HashMap”)
- object (class “java.util.HashMap”, {context=org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@313553f5: startup date [Thu Dec 10 08:28:22 CET 2015]
; root of context hierarchy, sessionEventBus=DefaultSessionEventBus[id=5a713e29, eventScope=SESSION, parentEventBus=DefaultApplicationEventBus[id=52eb9cdb, eventScope=APPLICATION, parentEventBus=null]
], com.vaadin.spring.internal.BeanStore=SessionAwareBeanStore[id=162eb3ce, name=Session:7045FADBA07391028A8448095F42E802]
, com.vaadin.spring.internal.UIScopeImpl$UIStore=UIStore[id=151b1e3d, sessionId=7045FADBA07391028A8448095F42E802]
})
- field (class “com.vaadin.server.VaadinSession”, name: “attributes”, type: “interface java.util.Map”)
- object (class “com.vaadin.server.VaadinSession”, com.vaadin.server.VaadinSession@6e4fadb9)
- custom writeObject data (class “java.util.concurrent.ConcurrentHashMap”)
- object (class “java.util.concurrent.ConcurrentHashMap”, {com.vaadin.server.VaadinSession.springVaadinServlet=com.vaadin.server.VaadinSession@6e4fadb9, springVaadinServlet.lock=java.util.concurrent.locks.ReentrantLock@36265ddf[Locked by thread http-nio-8080-exec-7]
, SPRING_SECURITY_CONTEXT=org.springframework.security.core.context.SecurityContextImpl@f0f2f552: Authentication: TOKEN
- field (class “org.apache.catalina.session.StandardSession”, name: “attributes”, type: “interface java.util.Map”)
- root object (class “org.apache.catalina.session.StandardSession”, StandardSession[7045FADBA07391028A8448095F42E802]
)

Our Application runs with Spring Boot v. 1.3.0 and Vaadin 7.5.9.

Has somebody an Idea to solve that Issue?

Hi, I have the same problem

Sprint Boot 1.4, Vaadin 7.6

We moved on from Vaadin.
A possible solution was to request the object again and
modify it without showing it in Vaadin and then save it.
Which is dumb, but nothing else worked.

similar issue. Vaadin 7.7.3 and spring boot 1.3.5

Did anybody come up with a workable solution?
We are facing the same issue with spring Boot 1.5.10, vaadin 8.4.2, hazelcast (session replication) 3.10.2.
thank you

Yep,

it worked, initially we have changed the spring boot vadding thingy, and we had a pull request witht the fix

long story short, version 2.0.1 should fix it

Thanks Renato. Just to confirm, are you referring to Spring Boot 2.0.1?

Actually no.

i’m talkign about vaadin spring module.
https://github.com/vaadin/spring

Btw, i’m not sure if it will make any difference, but we were using Redis not Hazelcast.