3 Replies Latest reply on May 14, 2003 1:14 AM by slaboure

    Load balancing fails -- Session replication

    zorzella

      Hi,

      I've successfully set up a cluster of two jboss 3.2.0 boxes A & B running my app.ear. Everything works fine, AFAICT. Then I setup a third box with JK2+Apache for load-balancing, and now I get, for each request, a different server.

      It seems the Session Replication is not working. If I try to login into the application, the first request ('/Login") goes to A, the user is registered with the session, and redirected to "/MyApp" page, which is sent to "B". "B" looks up the Session, and does not find the user there, and redirects it to "A" (all my app pages are "login" protected). And, yes, I do have "instant" as my replication mode.

      I would setup "sticky" sessions, so the load balancer would always send requests to the same node, but I can't make it work with JK2 (any help in that would be awesome, BTW).

      Check the relevant code below.

      Thanks a lot!

      Zorzella

      When logging in:

      HttpSession session = request.getSession ();
      session.setAttribute (USER_KEY, value);

      Then, to check if the user is logged in:

      if (request.getSession ().getAttribute (USER_KEY) != null)
      return true;