You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2006/05/02 23:07:44 UTC

FYI: Caused by: java.io.NotSerializableException: com.xyz.bean can sometimes be related to com.xyz.bean.innerclass

I just spent a lot of time on a really nasty error, so I figured I
should document on the mailing list in case someone else runs across
it.

Attempting to use t:saveState on an object that contains references to
a serializable inner class of a bean requires that the bean containing
the inner class be serializable.

That certainly wasn't obvious to me.

It would have made my life a lot easier if the error had been something like:

javax.faces.FacesException: java.io.NotSerializableException:
com.xyz.project.jsf.page.EditAuthorizationDocumentPage$innerclass

or

javax.faces.FacesException: java.io.NotSerializableException: Cannot
serialize inner class because outer class
com.xyz.project.jsf.page.EditAuthorizationDocumentPage is not
serializable.


But instead, you receive the not-very-helpful error:

javax.faces.FacesException: java.io.NotSerializableException:
com.xyz.project.jsf.page.EditAuthorizationDocumentPage
	at org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtils.java:179)
	at org.apache.myfaces.shared_impl.util.StateUtils.construct(StateUtils.java:140)
	at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeState(HtmlResponseStateManager.java:102)
	at org.apache.myfaces.application.jsp.JspStateManagerImpl.writeState(JspStateManagerImpl.java:430)
	at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:579)
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)