Hi,

I wrote this (read below) in the comments of bug JIRA MYFACES-75
(exception during server-side state saving). Thought it might be useful
to send it to the list as well, cause I surely don't know what's the
proper way to fix this.. Anybody got any good ideas? 

Kalle 

---
I believe servlet spec 2.3 requires that a container is able to
serialize the session for persistence. In Tomcat, you can configure a
session.PersistentManager to not try to store the session on disk by
setting its attribute "saveOnRestart" to false. The attribute by default
is true, which causes the whole problem. 

Just marking JspStateManagerImpl serializable isn't enough to fix the
problem. When I was working with sourceforge codebase, I experimentally
hacked and successfully fixed the problem with these steps:
- marked ...application.jsp.JspStateManagerImpl Serializable
- marked its private member _renderKitFactory transient
- marked javax.faces.application.StateManager.SerializedView (an inner
class) Serializable
- marked its private members _structure and _state transient

However, I never made a patch for it, because I seriously doubt that
making these changes is the correct way of solving the problem. If you
make the private members transient, it prevents the serialization of
backing beans in session scope. It might also be that backing beans
shouldn't be included when the container is trying to serialize the
session, but not sure. 

I guess the view is stored in session for being able to restore it, but
when the container is shutting down, it should be removed from the
session. I don't think it should be serializable at all. About the
StateManager, I'm not too sure if it should or not.
Surely we shouldn't throw an exception of StateManager not being
Serializable, but I would almost leave some exception there or, better
yet, a descriptive error message, and just force the users to either
configure their containers correctly or deal with it some other way.

> -----Original Message-----
> From: Sean Schofield [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, January 08, 2005 3:07 PM
> To: MyFaces Development
> Subject: Re: Exception during server-side state saving
> 
> Matthias,
> 
> Then it seems like additional classes need to be made Serializable.
> My application was *very* simple so I didn't run into this problem.
> 
> I still think you need my patch b/c if you take it out, it 
> will complain that JspStateManagerImpl can't be serialized.
> 
> I don't know enough about MyFaces yet to know why 
> JspStateManagerImpl should be serialized.  I suspect 
> somewhere the code is trying to store it in the session.  The 
> solution is to stop requiring that it be serialized or fix 
> all of the potential things that could be stored in 
> JspStateManagerImpl and make them serializable as well.
> 
> I will try to look into it.
> 
> Regards,
> sean
> 
> 

Reply via email to