title: Clustering (Apache 2.2.25 mod_jk + JBoss EAP 6.2) with Session Replication OFF and stickiness ON does not work
body: <p>I am using JBoss EAP 6.2 and Apache 2.2.25-no-ssl for load balancing and clustering deployment of my application.</p>
  
  <p>I want <strong>Session Replication off</strong> and <strong>Sticky session on</strong>.</p>
  
  <p>But after doing all sort of configurations, what I noticed that my load balancer not sticking user request based on session-id to one particular node, instead forwarding request to another node.</p>
  
  <p>Below are my cluster configurations.</p>
  
  <p>No of cluster nodes = 2</p>
  
  <p>Apache Load balancer = Apache 2.2.25-no-ssl</p>
  
  <p>App server = JBoss EAP 6.2.0</p>
  
  <p><strong>Apache Load Balancer configuration</strong></p>
  
  <p><strong>workers.properties</strong></p>
  
  <pre><code># Define list of workers that will be used
  # for mapping requests
  worker.list=loadbalancer,status
  
  # Define Node1
  # modify the host as your host IP or DNS name.
  worker.node1.port=8009
  worker.node1.host=172.20.150.33
  worker.node1.type=ajp13
  worker.node1.ping_mode=A
  worker.node1.lbfactor=1 
  
  # Define Node2
  # modify the host as your host IP or DNS name.
  worker.node2.port=8209
  worker.node2.host=172.20.150.33
  worker.node2.type=ajp13
  worker.node2.ping_mode=A
  worker.node2.lbfactor=1
  
  # Load-balancing behavior
  worker.loadbalancer.type=lb
  worker.loadbalancer.balance_workers=node1,node2
  worker.loadbalancer.sticky_session=1
  
  # Status worker for managing load balancer
  worker.status.type=status
  </code></pre>
  
  <p><strong>uriworkermap.properties</strong></p>
  
  <pre><code># Simple worker configuration file
  
  # Mount the Servlet context to the ajp13 worker
  /*=loadbalancer
  </code></pre>
  
  <p><strong>mod-jk.conf</strong></p>
  
  <pre><code># Load mod_jk module
  # Specify the filename of the mod_jk lib
  LoadModule jk_module modules/mod_jk.so
  
  # Where to find workers.properties
  JkWorkersFile conf/workers.properties
  
  # Where to put jk logs
  JkLogFile logs/mod_jk.log
  
  # Set the jk log level [debug/error/info]
  JkLogLevel debug 
  
  # Select the log format
  JkLogStampFormat  "[%a %b %d %H:%M:%S %Y]"
  
  # JkOptions indicates to send SSK KEY SIZE
  JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
  
  # JkRequestLogFormat
  JkRequestLogFormat "%w %V %T"
  
  # Mount your applications
  # The default setting only sends Java application data to mod_jk.
  # Use the commented-out line to send all URLs through mod_jk.
  # JkMount /* loadbalancer
  JkMount /* loadbalancer
  
  # Add shared memory.
  # This directive is present with 1.2.10 and
  # later versions of mod_jk, and is needed for
  # for load balancing to work properly
  JkShmFile logs/jk.shm 
  
  # You can use external file for mount points.
  # It will be checked for updates each 60 seconds.
  # The format of the file is: /url=worker
  # /examples/*=loadbalancer
  JkMountFile conf/uriworkermap.properties
  
  # Add jkstatus for managing runtime data
  &lt;Location /jkstatus/&gt;
  JkMount status
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
  &lt;/Location&gt;
  </code></pre>
  
  <p>mod-jk.conf loaded in httpd.conf file and Apache runs on port 80.</p>
  
  <p>In JBoss EAP, create two replica named <strong>node1</strong> and <strong>node2</strong> of <strong>standalone</strong> folder on same machine as depicted below</p>
  
  <p><img src="https://i.stack.imgur.com/Auno8.png" alt="enter image description here"></p>
  
  <p><strong>Command to start server :</strong> </p>
  
  <p><strong>node1</strong></p>
  
  <pre><code>standalone.bat -c standalone-ha.xml -b 172.20.150.33 -u 230.0.10.0 -Djboss.server.base.dir=../node1 -Djboss.node.name=node1 -Dlogging.configuration=file:/${JBOSS_HOME}/node1/configuration/logging.properties
  </code></pre>
  
  <p><strong>node2</strong></p>
  
  <pre><code>standalone.bat -c standalone-ha.xml -b 172.20.150.33 -u 230.0.10.0 -Djboss.server.base.dir=../node2 -Djboss.node.name=node2 -Dlogging.configuration=file:/${JBOSS_HOME}/node2/configuration/logging.properties -Djboss.socket.binding.port-offset=200
  </code></pre>
  
  <p>I tried with Session Replication On (by adding  in web.xml) but still same problem exists.</p>
  
  <p>Below are my JSESSIONID observations.</p>
  
  <p><strong>on first request</strong> </p>
  
  <pre><code>JSESSIONID = SY1d0wVTmX2b-czp50whdmCW.61423f3f-b623-3da4-bd2f-69ba448af636 where 61423f3f-b623-3da4-bd2f-69ba448af636 is JVM-ROUTE for node2.
  </code></pre>
  
  <p>on second request </p>
  
  <pre><code>JSESSIONID = QMTCTAzt2u-ANTidqZdBIzxO.f742b8d4-46f7-3914-86bb-1044d0a1bfce where f742b8d4-46f7-3914-86bb-1044d0a1bfce is a JVM-ROUTE for node1.
  </code></pre>
  
  <p>It seems even though jvm-route is appended to primary session id , still load balancer(apache mod-jk) sending request to other node instead of sticking to one on which session established.</p>
  
  <p>Please do helpful.</p>