I found a lot of articles to @ViewScoped
and java.io.NotSerializableException
but nothing helped in my case. Perhaps because I am using CDI @ViewScoped
and most older questions are about @ManagedBean
. Reproduction:
I have a presentation model with following annotation:
@javax.inject.Named
@javax.faces.view.ViewScoped
public class WishPM implements Serializable{
[...]
}
Deploying works fine. Also when I access the page using this PM all is fine. But when redeploy the project now after changing something I get:
INFO: Cannot serialize session attribute com.sun.faces.application.view.activeViewContexts for session ad1a37e9cf5e1445cabc04a944e0
java.io.NotSerializableException: org.jboss.weld.bean.ManagedBean
[...]
WARNING: Unable to restore sessions for web module [/wish] from previous deployment
java.lang.NullPointerException
This is not happening if I use @SessionScoped or @Requestscoped. From other threads I have the tip to set STATE_SAVING_METHOD to server in web.xml. It was not set to client so it should have been the default. But at all I set it:
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
But still the same error. Can someone help me what to try?