This application test the session replication works on a GlassFish cluster.
In order to test session replication, you need to have one of the following setups:
- run all the GlassFish instances locally, on the same IP address, different ports, no load balancer needed
- run GlassFish insances on different IP addresses, with a load balancer, access the application using the load balancer
First, access instance A (here named server1) and store some data to the HTTP session (e.g. name=OmniFish).
Then access instance B (using the same IP address or domain as instance A). Instance B should report the same data stored in instance A - data is replicated.
If all instances run on the same IP, you can access the instance A and instance Bdirectly, using IP and port. The browser will send the session cookie to all instances.
If instances run behind a load balancer server, always access the application via the load balancer server. First, make the load balancer only work with instance A, then make it work with instance B.
mvn install
When deploying, enable availability and select the cluster as the target:




