Hi AJ,
Thanks for your reply.First of all sorry for the delayed response from my side. I tried as you said(Implementing Serializable interface in HttpSessionActivationListener class) and I'm getting "SessionDidActivated" message but not when I expected.
Here's the Scenario when I'm getting SessionDidActivated
=====================================
When I stop Tomcat instance (say for example currently "Tomcat Instance 1" is serving the request) after hitting "SessionExample" Servlet (mapped as "/sessiontest.do") as I said I'm getting "SessionWillPassivate " message . When I start the same Tomcat instance again I'm getting "SessionDidActivated" message.
What I Thought
==========
After stopped the Tomcat instance I reloaded the same page expecting this time it will served by another Tomcat instance(say "Tomcat Instance 2" and I will get "SessionDidActivated" message since the session will be migrated.
As I expected the page is served by another Tomcat instance
but the session is not migrated and I'm not getting "SessionDidActivated" in the new Tomcat instance.
I also created a new Servlet named as (Servlet3) and modified SessionExample.java so that It contains button and when it clicked it will hit a new Servlet(Servlet 3) to
test this instead of reloading the same page but it also doesn't help.
Modified Source codes
===============
Modified Listener class
-------------------------
Added in web.xml
---------------------
Modified SessionExample.java
-----------------------------------
Servlet3.java
---------------
I'm trying this in a single physical machine with two tomcat instance configured with Apache Http Server .
Is anything I'm missing ? Will it work ?
Thanks for your patience for reading lengthy post .