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

get NotSerializableException when using @Subscribe in tomcat cluster env.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.0.3
    • Fix Version/s: 6.5.1
    • Component/s: Components
    • Labels:
      None
    • Environment:

      ZK 6.0.4 fl. tomcat 6 node 1,2 with apache2 in linux.
      note : tomcat will not serialize session if you has only 1 node.

      Description

      get NotSerializableException when using @Subscribe in tomcat cluster env.

      <zk>
      	<window id="win" title="Hello World!!" border="normal" width="500px" 
      		apply="zkforge.zkcache.BugComposer">
      		<textbox id="tb"/>
      		<hlayout>
      		<button label="set"/>
      		</hlayout>
      	</window>
      </zk>
      
      
      package zkforge.zkcache;
      
      import org.zkoss.zk.ui.event.Event;
      import org.zkoss.zk.ui.event.EventQueues;
      import org.zkoss.zk.ui.select.SelectorComposer;
      import org.zkoss.zk.ui.select.annotation.Listen;
      import org.zkoss.zk.ui.select.annotation.Wire;
      import org.zkoss.zkmax.ui.select.annotation.Subscribe;
      import org.zkoss.zul.Textbox;
      import org.zkoss.zul.Window;
      
      public class BugComposer extends SelectorComposer {
      	private static final long serialVersionUID = 1L;
      
      	@Wire
      	Window win;
      
      	@Wire
      	Textbox tb;
      
      	@Listen("onClick = button[label='set']")
      	public void set() {
      		String value = tb.getValue();
      		System.out.println(">>>set " + value);
      		EventQueues.lookup("myqueue", "desktop", true).publish(new Event("onSet"));
      	}
      
      	@Subscribe(value = "myqueue", scope = "desktop")
      	public void subscribe() {
      		System.out.println(">>>get queue event " + this);
      	}
      }
      
      java.io.NotSerializableException: org.zkoss.zk.ui.select.Selectors$ComposerEventListener
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at java.util.LinkedList.writeObject(LinkedList.java:943)
      	at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at java.util.HashMap.writeObject(HashMap.java:1001)
      	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at org.zkoss.io.Serializables.smartWrite(Serializables.java:61)
      	at org.zkoss.zk.ui.impl.DesktopImpl.writeObject(DesktopImpl.java:1027)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at java.util.HashMap.writeObject(HashMap.java:1001)
      	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:422)
      	at org.zkoss.util.CacheMap.writeObject(CacheMap.java:632)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at org.zkoss.zk.ui.http.SimpleSession.writeThis(SimpleSession.java:435)
      	at org.zkoss.zk.ui.http.SerializableSession.writeObject(SerializableSession.java:71)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      	at org.apache.catalina.ha.session.DeltaRequest$AttributeInfo.writeExternal(DeltaRequest.java:389)
      	at org.apache.catalina.ha.session.DeltaRequest.writeExternal(DeltaRequest.java:287)
      	at org.apache.catalina.ha.session.DeltaRequest.serialize(DeltaRequest.java:302)
      	at org.apache.catalina.ha.session.DeltaManager.serializeDeltaRequest(DeltaManager.java:742)
      	at org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1253)
      	at org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1218)
      	at org.apache.catalina.ha.tcp.ReplicationValve.send(ReplicationValve.java:550)
      	at org.apache.catalina.ha.tcp.ReplicationValve.sendMessage(ReplicationValve.java:537)
      	at org.apache.catalina.ha.tcp.ReplicationValve.sendSessionReplicationMessage(ReplicationValve.java:519)
      	at org.apache.catalina.ha.tcp.ReplicationValve.sendReplicationMessage(ReplicationValve.java:430)
      	at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:363)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
      	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
      	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)
      	at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
      	at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
      	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
      	at java.lang.Thread.run(Thread.java:662)
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            dennis dennis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: