I seem to recall that the existing Session clustering only distributes the state on the addition or removal of objects, not changes in the objects themselves. So it is not aware of any chages to the objects outside of the session, once the object has been added.
Try making sure that you create a new object based on the incremented counter and see if adding it under the same key causes the session to be distributed properly.
This is one way I was looking to implement clustering into Jetty way back when I was going to try to help them with it. It is pretty impossible to watch objects change that are in the session. However, because each servlet container can implement the setAttribute(), removeAttribute() and getAttribute() calls, they inject code that can replicate the object being added (or removed) in their implementation. Thus, what you need to do is every time you change any object, any ref in an object, etc that is in the HttpSession, you need to re-add it to the session. Simply doing session.setAttribute(key, value) will do the trick, or so it should.
One thing I did with my own MVC framework a while back was institute this in the code. Every time an "action" came in, at the END of the call before the request went back I automatically re-added every javabean that was used by the request. I did not do this for any other objects, as there is know way for my framework to know what objects a servlet may use. But, if the framework was used correctly, all session objects were JavaBeans anyway and thus would automatically enforce state replication IF the container that the framework was being used in supported that manner of replication.
Thanks all for you help...
I tried as you suggested with the same result. Do you know where I might look for extending the session clustering to add my desired behaviour?
I don't quite understand what you mean? Extending the clustering session?
Sorry for not being clear, but yes is there any way to do this or am I stuck?
I saw this topic and thought that it fit quite nicely with the problems I'm having. My setup is the following:
RH 9, JBoss 3.2.1, J2ee 1.4_beta2
Win2k, JBoss 3.2.1, J2ee 1.4_beta2
Now, what I want to do is to set the whole thing up so that it will support load balancing. Clustering works but when I set the tag on the windows computer it can't do anything. It stops working. On the linux computer on the other hand, it works fine until I try to login, then it complains about that attributes need to be serializable. But I can't even login on the windows computer except if I remove the <dist..> tag.
I have also set this up with apache and mod_jk v1.2.3 and it almost works. It forwards me to my windows box but well, as described, can't login from there.
Hope you have any good suggestions.