ICEfaces
  1. ICEfaces
  2. ICE-7222

Problems serializing some session resources

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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)

        Activity

        Hide
        Deryk Sinotte added a comment -

        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:

        • deploying component-showcase.war
        • loading the initial page
        • shutting down Tomcat
        • restarting Tomcat

        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

        • field (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", name: "resource", type: "interface org.icefaces.impl.push.http.DynamicResource")
        • object (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer@4e837645)
        • field (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", name: "server", type: "class org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer")
        • object (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", org.icefaces.impl.push.DynamicResourceDispatcher$Mapping@76938855)
        • custom writeObject data (class "java.util.HashMap")
          ....

        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

        • field (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup", name: "CK_LINKED_BASE", type: "interface com.icesoft.faces.context.ResourceLinker$Handler")
        • object (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup", com.icesoft.faces.component.inputrichtext.InputRichTextSetup@3771ed5e)
        • field (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup$RelativeResource", name: "this$0", type: "class com.icesoft.faces.component.inputrichtext.InputRichTextSetup")
        • object (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup$RelativeResource", com.icesoft.faces.component.inputrichtext.InputRichTextSetup$RelativeResource@4b6e3f87)
        • field (class "com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter", name: "resource", type: "interface com.icesoft.faces.context.Resource")
        • object (class "com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter", com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter@2f590164)
        • field (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", name: "resource", type: "interface org.icefaces.impl.push.http.DynamicResource")
        • object (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer@5dcd8bf7)
        • field (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", name: "server", type: "class org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer")
        • object (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", org.icefaces.impl.push.DynamicResourceDispatcher$Mapping@34780af5)
        • custom writeObject data (class "java.util.HashMap")
          ...

        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.

        Show
        Deryk Sinotte added a comment - 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: deploying component-showcase.war loading the initial page shutting down Tomcat restarting Tomcat 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 field (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", name: "resource", type: "interface org.icefaces.impl.push.http.DynamicResource") object (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer@4e837645) field (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", name: "server", type: "class org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer") object (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", org.icefaces.impl.push.DynamicResourceDispatcher$Mapping@76938855) custom writeObject data (class "java.util.HashMap") .... 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 field (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup", name: "CK_LINKED_BASE", type: "interface com.icesoft.faces.context.ResourceLinker$Handler") object (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup", com.icesoft.faces.component.inputrichtext.InputRichTextSetup@3771ed5e) field (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup$RelativeResource", name: "this$0", type: "class com.icesoft.faces.component.inputrichtext.InputRichTextSetup") object (class "com.icesoft.faces.component.inputrichtext.InputRichTextSetup$RelativeResource", com.icesoft.faces.component.inputrichtext.InputRichTextSetup$RelativeResource@4b6e3f87) field (class "com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter", name: "resource", type: "interface com.icesoft.faces.context.Resource") object (class "com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter", com.icesoft.faces.context.ResourceRegistryLocator$DynamicResourceDispatcherAdapter$DynamicResourceAdapter@2f590164) field (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", name: "resource", type: "interface org.icefaces.impl.push.http.DynamicResource") object (class "org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer", org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer@5dcd8bf7) field (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", name: "server", type: "class org.icefaces.impl.push.DynamicResourceDispatcher$ResourceServer") object (class "org.icefaces.impl.push.DynamicResourceDispatcher$Mapping", org.icefaces.impl.push.DynamicResourceDispatcher$Mapping@34780af5) custom writeObject data (class "java.util.HashMap") ... 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.
        Hide
        Deryk Sinotte added a comment -

        Checked in the changes I noted under -r25479. Marking as resolved.

        Show
        Deryk Sinotte added a comment - Checked in the changes I noted under -r25479. Marking as resolved.

          People

          • Assignee:
            Deryk Sinotte
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: