ICEfaces
  1. ICEfaces
  2. ICE-10599

Showcase -> "WARNING: Cannot serialize session attribute org.icefaces.impl.application.WindowScopeManager" in logs

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: Sample Apps
    • Labels:
      None
    • Environment:
      ICEfaces 4 Showcase sample application.
    • Affects:
      Sample App./Tutorial

      Description


      CATALINA_OPTS =“$CATALINA_OPTS -Dsun.io.serialization.extendedDebugInfo=true”

      After working that out, I was able to replicate the problem by putting a bunch of List portlets on a page and then shutting down Liferay:

      WARNING: Cannot serialize session attribute org.icefaces.impl.application.WindowScopeManager for session E1EB0273304D68B5EF4F4946FB698B0D
      java.io.NotSerializableException: java.util.ArrayList$SubList
      - field (class "org.icefaces.samples.showcase.example.ace.list.ListBean", name: "carList", type: "interface java.util.List")
      - object (class "org.icefaces.samples.showcase.example.ace.list.ListBean", org.icefaces.samples.showcase.example.ace.list.ListBean@6ef83014)
      - custom writeObject data (class "java.util.HashMap")
      - object (class "org.icefaces.impl.application.WindowScopeManager$ScopeMap", {listBean=org.icefaces.samples.showcase.example.ace.list.ListBean@6ef83014, listDragBean=org.icefaces.samples.showcase.example.ace.list.ListDragBean@373aa303, navigationModel=org.icefaces.samples.showcase.view.navigation.NavigationModel@2e398a81})
      - custom writeObject data (class "java.util.HashMap")
      - object (class "java.util.HashMap", {b0i7w7bvgu={listBean=org.icefaces.samples.showcase.example.ace.list.ListBean@6ef83014, listDragBean=org.icefaces.samples.showcase.example.ace.list.ListDragBean@373aa303, navigationModel=org.icefaces.samples.showcase.view.navigation.NavigationModel@2e398a81}, b0i7w7bvgt={listBean=org.icefaces.samples.showcase.example.ace.list.ListBean@7283ca81, listDualBean=org.icefaces.samples.showcase.example.ace.list.ListDualBean@5dd43c55, navigationModel=org.icefaces.samples.showcase.view.navigation.NavigationModel@3f14be57, listBlockComplexBean=org.icefaces.samples.showcase.example.ace.list.ListBlockComplexBean@5d9b56b6}, lzi7w72eh9={listBean=org.icefaces.samples.showcase.example.ace.list.ListBean@31a05846, listSelectionBean=org.icefaces.samples.showcase.example.ace.list.ListSelectionBean@4deafcb3, navigationModel=org.icefaces.samples.showcase.view.navigation.NavigationModel@5796155f}})
      - writeExternal data
      - root object (class "org.icefaces.impl.application.WindowScopeManager$State", org.icefaces.impl.application.WindowScopeManager$State@2d6ae235)


      The culprit seems to be the use of the method .subList() as it return a version of a List that is *not* Serializable. We have a couple of usages of subList() in our ListBean:

      Line 93: carList = carList.subList(0,6);
      Line 112: List<Car> carList = DataTableData.getDefaultData().subList(0,10);

      Googling shows that this is a pretty common “gotcha”. It’s also not portlet specific as I was able to get the same thing to pop up with plain showcase and Tomcat 7. The generally recommend way to fix this is to just wrap it with something that is Serializable, like an ArrayList():

      Line 93: carList = new ArrayList(carList.subList(0,6));
      Line 112: List<Car> carList = new ArrayList(DataTableData.getDefaultData().subList(0,10));

      However, doing a search for the app code shows that the use of subList() extends beyond that one class so a fix would mean a more comprehensive review of the beans and weeding out/converting all the usages.

        Issue Links

          Activity

          Hide
          Ken Fyten added a comment -

          Resolved via wrapping .subList results in new ArrayList's to fix serialization issues.

          Show
          Ken Fyten added a comment - Resolved via wrapping .subList results in new ArrayList's to fix serialization issues.

            People

            • Assignee:
              Ken Fyten
              Reporter:
              Ken Fyten
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: