I have an environment where 2 load-balanced clustered tomcats pointing to same application.
When they run under sticky session and not shared session, they works fine. Now I am implementing failover for tomcat. ie If one one fails other handles the sessions that handled by the failed one. And I am trying in-memory session replication.
When I enable this feature, I am getting some exceptions like
org.apache.catalina.ha.session.DeltaManager requestCompleted SEVERE: Unable to serialize delta request for sessionid [68930629D2318EFAC06F3D75FFA162D0.tomcat2] java.io.NotSerializableException: org.json.JSONObject 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.writeObject(ObjectOutputStream.java:326) at org.apache.catalina.ha.session.DeltaRequest$AttributeInfo.writeExternal(DeltaRequest.java:374) at org.apache.catalina.ha.session.DeltaRequest.writeExternal(DeltaRequest.java:272) at org.apache.catalina.ha.session.DeltaRequest.serialize(DeltaRequest.java:287) at org.apache.catalina.ha.session.DeltaManager.serializeDeltaRequest(DeltaManager.java:640) at org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1120) 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.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:210) 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:769) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:619) Sep 11, 2009 7:21:06 PM org.apache.catalina.ha.session.DeltaManager requestCompleted SEVERE: Unable to serialize delta request for sessionid [68930629D2318EFAC06F3D75FFA162D0.tomcat2] java.io.NotSerializableException: org.json.JSONObject
Since JSON is not serialized I am putting it inside an ArrayList before setting it in session. And it works fine in non shared session environment.
What I need to do for enabling fail over? (Please done tell something like don't save the object in session. Its not only the one object which causing error. I am getting errors for other objects like Data source etc.. as well)
Thanks in advance
Umesh
Edit: Have already implemented serialization and transient
public class ABC implements Serializable { private static final long serialVersionUID=2007L; public static transient DataSource source;
Getting this error java.io.NotSerializableException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper ... storing attribute 'ABC' with value NOT_SERIALIZED