I'm deploying a simple EAR identically on two machines. It has a get.jsp and put.jsp.
Get.jsp adds the current time to the session
Put.jsp reads that same time from the session and prints it, or prints NULL
The nodes are successfully deployed in a cluster
01:49:25,747 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-8,null) ISPN000094: Received new cluster view: [host1/web|9] [host1web, host2/web]
And
01:49:26,567 INFO [org.jboss.as.clustering] (MSC service thread 1-5) JBAS010238: Number of cluster members: 2
I'm intentionally NOT using mod_cluster or any other load balancer out of requirement. Now, when I go to
host1 : port/put.jsp
It writes the current time to the host1 session, which I verified by going to host1 : port/get.jsp. However, when I kill host 1, I try to go to host2 : port/get.jsp and get NULL, so the session does not exist.
My WAR file has the <distributable/> tag in web.xml and I have defined a jboss-web.xml file in the WEB-INF folder which specifies how session replication should be done as defined by this link: https://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/beta500/html/clustering-http-app.html
What else do I need to do to enable replication without a load balancer? I have 100% verified that there are no firewalls, antiviruses, or anything else preventing communication between the hosts.
I've also verified that this seemingly actually WORKS when attaching mod_cluster with httpd load balancer and connecting through the load balancer. But I don't want to use this. Any suggestion for what I could be doing wrong?
You need to have the LB in front of your JBoss cluster to have the same sessionID.
If you access JB1/*.jsp and JB2/*.jsp this created different sessions.