Reputation: 1713
I'm in the process of migrating from jsf1.1 to jsf2.0. When testing one of the jsf page that I've converted, it encountered the java.io.NotSerializableException on one of the class. I'm not getting this error when it was under jsf1.1. To resolve the problem, I added the Serializable interface to the class. After I did that I get the same error on a different class. I know I can simply add Serializable interface to this class to resolve the issue. But is this normal when migrating from jsf1.1 to jsf 2.0?
Upvotes: 0
Views: 298
Reputation: 20691
You're only getting this error now because in JSF 1.x, partial state saving wasn't a requirement. For a primer on JSF state saving, See this question.
From the JSF 2.x Spec:
For Applications versioned at 1.2 and under, the runtime must not use the partial state saving mechanism. For applications versioned at 2.0 and above, the runtime must use the partial state saving mechanism
This stipulation is what forces any and all view components to be serializable
Upvotes: 1
Reputation: 3651
Technically, anything stored in the session should be serializeable. In JSF, the view and flash scopes are stored within the session. So in short anything not in the request scope will end up in the session. However, you don't see the error until things are serialized out of the session. I don't know the details, but there msut be a difference in JSF 1.1 and JSF 2.0 implementations were JSF 2.0 is more aggressive at serializing the session.
Upvotes: 0