Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: EE-2.0.0.GA, 2.0.2
-
Fix Version/s: 2.1-Beta, EE-2.0.0.GA_P01
-
Component/s: Framework, ICE-Components
-
Labels:None
-
Environment:ICEfaces 2 session serialization
Description
There have been reports of problems with session serialization, specifically when starting/stopping/redeploying apps on Tomcat. The following is a stack trace reported by QA when running tests against the compat version of Component Showcase:
Sep 14, 2011 9:59:55 AM org.apache.catalina.session.StandardSession writeObject
WARNING: Cannot serialize session attribute org.icefaces.impl.push.DynamicResourceDispatcher$SessionBasedResourceDispatcher for session 8BC56C0BC0831DF53CC6B64D43C1E156
java.io.NotSerializableException: com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at java.util.HashMap.writeObject(HashMap.java:1001)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Sep 14, 2011 9:59:55 AM org.apache.catalina.session.StandardSession writeObject
WARNING: Cannot serialize session attribute org.icefaces.impl.push.DynamicResourceDispatcher$SessionBasedResourceDispatcher for session 8BC56C0BC0831DF53CC6B64D43C1E156
java.io.NotSerializableException: com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at java.util.HashMap.writeObject(HashMap.java:1001)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Looks like there was some work done that is related to this in http://jira.icefaces.org/browse/ICE-6714.
In any event, I was able to replicate the issue (or something very similar) by:
During the restart, it would attempt to read the serialized session and throw the same exception as noted in the original description. To debug, I set the following JVM runtime parameter:
-Dsun.io.serialization.extendedDebugInfo=true
This parameter provides additional details when serialization of an object graph fails. The first thing it turned up is:
Caused by: java.io.NotSerializableException: com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter
....
So I made the following change and re-ran the test:
private static class DynamicResourceAdapter implements DynamicResource, Serializable {
This got us a bit farther:
SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.icesoft.faces.component.inputrichtext.InputRichTextSetup$1
...
This time, I refactored the anonymous class of InputRichTextSetup and allow it to implement Serializable:
private final ResourceLinker.Handler CK_LINKED_BASE = new LinkHandler();
private class LinkHandler implements ResourceLinker.Handler, Serializable{
...
After that, the test application appears to run cleanly with no detectable side-effect on the Rich Text component behaviour.