I guess that when the object is atached to the session or dismissed from the session..here by session i mean the user session (request.getSession()) this works...but in your case your are setting it to the ServletContext.
i have not tested this ...so , kindly let me know whether it works for you.
Rahul, this is a plain old Java class (Not a servlet). HtpSessionBindingListener causes an object to be notified when it is bound to or unbound from a session. And this happens when the object is added, replaced or removed from the session. As in SetAttribute, removeAttribute, replaceAttribute.
Bosun (SCJP, SCWCD).
So much trouble in the world -- Bob Marley