XMPPConnection is not serialized

Hi

Currently I am facing XMPP connection object not Serialized exception in web based chat application with clustered environment.

Please do needful for the same.

Exception :

[#|2011-09-28T09:33:11.966-0400|INFO|sun-appserver2.1|org.apache.catalina.sessio n.ManagerBase|_ThreadID=19;_ThreadName=httpSSLWorkerThread-38184-1;|PWC2785: Cannot serialize session attribute org.springframework.web.context.request.ServletRequestAttributes.DESTRUCTION_CA LLBACK.scopedTarget.chatClient for session 0295bcb1604cc9074a44afdfdf7c

java.io.NotSerializableException: org.jivesoftware.smack.XMPPConnection

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.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 org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:20 45)

at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va: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:1461)

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 org.apache.catalina.session.StoreBase.writeSession(StoreBase.java:273)

at com.sun.enterprise.ee.web.sessmgmt.HAStoreBase.getByteArray(HAStoreBase.java:21 2)

at com.sun.enterprise.ee.web.sessmgmt.ReplicationStore.doValveSave(ReplicationStor e.java:176)

at com.sun.enterprise.ee.web.sessmgmt.ReplicationStore.valveSave(ReplicationStore. java:146)

at com.sun.enterprise.ee.web.sessmgmt.ReplicationWebEventPersistentManager.doValve Save(ReplicationWebEventPersistentManager.java:150)

at com.sun.enterprise.ee.web.sessmgmt.HASessionStoreValve.doPostInvoke(HASessionSt oreValve.java:162)

at com.sun.enterprise.ee.web.sessmgmt.HASessionStoreValve.postInvoke(HASessionStor eValve.java:104)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:661)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLocking StandardPipeline.java:98)

at com.sun.enterprise.ee.web.sessmgmt.SessionLockingStandardPipeline.invoke(Sessio nLockingStandardPipeline.java:120)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:16 6)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(Def aultProcessorTask.java:666)

at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(Default ProcessorTask.java:597)

at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultPr ocessorTask.java:872)

at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(D efaultReadTask.java:341)

at com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask.process(SSLReadTask.ja va:444)

at com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask.doTask(SSLReadTask.jav a:230)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThrea d.java:106)

Hi,

Have you found any solution for this. I am also trying to save XMPPConnection object and some other listeners liks packet and ChatManager Listerns… but getting same issue.

Please let me know if you have found any solution or workaround for the same.

Thank you,

Regards,

Aparna Bhure

XMPPConnection is coupled to physical resources (TCP sockets) on the machine in which it resides, therefore it cannot be made serializable. It is also has an identitiy associated with the connection to the server which cannot be duplicated, since a full JID can only be connected to the same server once, a second connection would force the other one to get disconnected.

The connection should not be put into the session, you have to manage it outside of that scope.