Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3282

Error deserializing Chosenbox

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.0.3
    • 7.0.8, 8.0.2
    • Clustering, Components
    • Security Level: Jimmy
    • None
    • ZK 8.0.3 S8, ZK 8.0.3 S9, ZK 8.0.3 S10

      steps to reproduce

      use a <chosenbox> in a cluster environment or in an appserver with enabled session serialization

      (See debug info more isolated reproducing/testing_

      actual result

      An exception when session deserializaion occurs:

      ==> ../logs/catalina.out <==
      25-Jul-2016 18:22:53.156 SEVERE [localhost-startStop-1] org.apache.catalina.session.StandardManager.startInternal Exception loading sessions from persistent storage
       java.lang.NullPointerException
              at org.zkoss.zk.ui.event.Events.postEvent(Events.java:415)
              at org.zkoss.zk.ui.event.Events.postEvent(Events.java:466)
              at org.zkoss.zk.ui.event.Events.postEvent(Events.java:397)
              at org.zkoss.zkmax.zul.Chosenbox.postOnInitRender(Chosenbox.java:830)
              at org.zkoss.zkmax.zul.Chosenbox.readObject(Chosenbox.java:914)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
              at org.zkoss.zk.ui.AbstractComponent.readObject(AbstractComponent.java:3503)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
      ...
      

      expected result

      working deserialization - components should continue to work after session deserialization

      debug info

      To test this in isolation (without having to setup a clustering environment) the attached JUnit Test (TestComponentDeserialization.java) reproduces the issue

      For integration testing the issue also happens using a tomcat8 (default config)
      configure zk session serialization in zk.xml:

          <system-config>
              <ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
          </system-config>
      

      Loading a zul file containing <chosenbox>
      shutdown tomcat
      startup tomcat (watch the logs - NPE occurs)

      root cause

      Chosenbox is posting events during deserializaion which fails since there is no active Execution present (e.g. during server startup)

              at org.zkoss.zk.ui.event.Events.postEvent(Events.java:397)
              at org.zkoss.zkmax.zul.Chosenbox.postOnInitRender(Chosenbox.java:830)
              at org.zkoss.zkmax.zul.Chosenbox.readObject(Chosenbox.java:914)
      

      Workaround

      Avoid using Chosenbox (other components should work)
      or
      conceptual idea: detach the component manually during sessionPassivation and create a new box and reattach it during sessionActivation (doesn't work, UUIDs are lost and other problems)

            wenninghsu wenninghsu
            cor3000 cor3000
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h