WildFly 8 Clustering and Session Failover (Tech Tip #16)

This blog contains a video tutorial on how to setup up HTTP session failover using WildFly 8. Specifically, it shows:

  • Introduction to WildFly and Managed Domain concepts
  • Setup up a 2-instance cluster
  • Deploy a WAR file to the cluster using centralized administration from admin console
  • Access the application on one node and add HTTP session attributes on it
  • Shutdown that instance and show HTTP session failover by accessing the application on other instance


Be Sociable, Share!
  • Tweet

36 thoughts on “WildFly 8 Clustering and Session Failover (Tech Tip #16)

  1. Hello, Arun.

    How are you?

    Congrats for great article, really very cool.

    Where I can get package http-1.0-SNAPSHOT.war ? I’d like to do some test in my lab.

    The package is private or public?

    Thank you.

  2. You can check out the workspace at https://github.com/arun-gupta/wildfly-samples/tree/master/clustering/http and build it yourself.

  3. Arun,

    Thanks for the great article! I have one question – do we have to use Apache httpd for fail-over? If so, do we install Apache httpd together with WildFly? Would Apache httpd then replaces functionality of Undertow?


  4. Yu,

    Apache httpd will only be the front end proxy. A future version of WildFly 8 will allow Undertow to be used as proxy as well, but not in WildFly 8.

  5. Hi Arun,
    Its a great article.. Thanks for that! I have one question for you, I am using 1 ELB and 2 Cent OS application server instance with JBoss. Where do you suggest to put the Domain controller? As that instance goes down then how system will work?


  6. Domain Controller is used only for the administration purpose and is not used during runtime. The requested is routed to the server-group with individual instances.

    Domain Controller can be placed on either of the machine, or even on a separate machine as well.

  7. Hello Arungupta,

    Gr8 video..!!! i have configured my clustering jboss wildfly 8 by ur way,the war file is working in different ports.But i configured and connect localhost/mywarfile.xhtml with http 2.2.26 + mod_cluster combination to connect jboss wildfly and it is not working.so could you please help me out from this issue?

  8. Mohammad,

    What error are you getting ?

    Have you tried https://docs.jboss.org/author/display/WFLY8/WildFly+8+Cluster+Howto ?

  9. Hello Arun,

    I have configured server-three as http:8340/mywar and server four as http:8440/mywarfile.if i started the jboss server i am able to access the locahost/myfilewar but when i stopped the server three i am getting below error.

    I am getting 503 Service Temporarily Unavailable
    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

    can you please tell what went wrong?

    Thanks & Regards,

  10. Hello Arun,

    Thanks for you nice documentation and video.

    I’m currently running my JBoss cluster using S3Ping configuration in AWS under Elastic Load Balencer, and this configuration is active-active and my application is not working as expected with this configuration and its more suitable with active-passive configuration, So I followed this documentation – https://docs.jboss.org/author/display/WFLY8/WildFly+8+Cluster+Howto , It’s worked for me except mod-cluster configuration.

    As I mentioned above, running all the instances in AWS cloud, launch 3 instances
    1. Domain controller and Master
    2. Slave
    3 Mod-cluster

    Master-Slave configuration is working perfectly and mod-cluster configuration is not working for me.

    1. In mod-cluster configuration, how will detect my master/slave instances, because there is no such configs in VirtualHost file.
    2. Is this confiration will work in AWS infrastructure

    Please advise me to configure this. thanks in advance.


  11. Jithin,

    This configuration should work. Can you post your question with complete details to WildFly forum at:


    Please include app server version and operating system.

  12. Arungupta,

    please advise me to configure httpd.conf (apache side) configuration for your above video?

    Thanks & Regards,

  13. Hello Arungupta,

    i have started two instances in standalone.xml by using below command,

    ./bin/standalone.sh -c standalone-ha.xml -Djboss.node.name=node1

    and another instance start by same but with port offset

    ./bin/standalone.sh -c standalone-ha.xml -Djboss.socket.binding.port-offset=100 -Djboss.node.name=node2

    i have configured my front end server (apache 2.4) by below configuration,

    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

    # Reverse Proxy

    BalancerMember ajp://localhost:8009/ route=node1
    BalancerMember ajp://localhost:8109/ route=node2
    ProxySet lbmethod=byrequests
    ProxySet failonstatus=404

    ProxyPass / balancer://mybalancer/ stickysession=JSESSIONID|jsessionid

    ProxyRequests Off

    Order deny,allow
    Deny from none
    Allow from localhost

    # Balancer-manager, for monitoring

    SetHandler balancer-manager
    Order deny,allow
    Deny from none
    Allow from none

    it is working fine when we connect through the apache but if i stop node1 and restart it
    i have got below warning

    WARN [org.jgroups.protocols.TP$ProtocolAdapter] (INT-1,shared=udp) JGRP000031: node2/web: dropping unicast message to wrong destination 109fb003-b554-43f3-463f-183b82e95308

    after that if i access the warfile through apache i have got an error like

    ERROR [org.apache.jasper] (default task-1) JBWEB005015: The JSP container needs a valid work directory [E:\jboss_3\standalone\tmp\cluster-demo.war]
    2014-06-24 12:31:10,318 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to //cluster-demo/index.jsp: org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.index_jsp

    please help me to overcome from this issue..!

    Thanks and Regards,

  14. Hi Arungupta,

    Thanks for your quick reply..! i have already posted in jboss forum too. but there is no solution for this issue.

    Thanks & Regards,

  15. Hi Arun
    I followed your tech tip very closely. I now have a domain controller running 2 host (2 different machines). I Also used your test code that you provided. Every thing works on every host (which runs 2 servers each). Can you please tell me how to get the hosts to “talk” to each other? For example if I add info on host 1, how do I get Host two to show that info?
    Thanks in advance

  16. Hi Arun,
    I configured wildfly in two system(master and slave) and able to control from center domain controller all the instances, but in my slave I am getting following exception

    Server:server-four-slave] 06:32:05,826 ERROR [org.hornetq.core.server] (default I/O-1) HQ224018: Failed to create session: HornetQClusterSecurityException[errorType=CLUSTER_SECURITY_EXCEPTION message=HQ119099: Unable to authenticate cluster user: HORNETQ.CLUSTER.ADMIN.USER]

    And session are not replicated in my slave instances but session replication is working properly in all instances of master host.. can you please suggest me whats going wrong do I need to do any special configuration?

  17. Hello Arun,

    This is a very good Article. I am involved in a project that requires setting up a HA using Wild Fly on multi nodes. The configuration should be Load Balancing and not just Fail-over.

    Could you point out to any resource that could help me with this?

    Vivek Raman

  18. Great video Arun! Very detailed and informative! That was cool how you showed the session data being failed over transparently. Does that easy failover also work for JEE websockets? If so, is there any additional configuration required to make that work? If not, is there a plan to make this work? I am just not sure if the websocket connection is considered part of the session data that gets failed over or if there are additional steps required.
    Thanks in advance,

  19. Fino,

    Stay tuned for a blog on WebSocket connection failover, coming shortly. WebSocket clients have to reconnect on failure, and this would act as failover.

  20. Hi Arun, Is there any information on how to use mod_cluster? Also is it possible to use failover with the CDI ViewScope? I’m seeing that the data is being lost when loading balancing between hosts. Any chance for a more realistic example?

  21. Hi Arun,
    we wanted to upgrade our JBoss7 servers to wildfly.
    But we have problem during our “logout” action where we are invalidating the sessions.

    While a long-running conversation is started and we are invalidating the session, we are getting exceptions and the WildFly server is completly blocked. We need to restart it.

    Exception is always thrown with WildFly version 8.1 and 9.0alpha1.
    Also the hudson build #1439 ip to #1449 are not working.

    But using the HudsonBuild #1334, everything is working as expected.
    We have already posted in the forums, but didn’t yet got an anwer:

    The forum post has a link to a demo war where we can reproduce the problem.

    Thanks for any help,

  22. Hi Arun,

    I’m running one clustered active-active Jboss7 application in AWS using ELB(autoscaling) with S3Ping module, I want to upgrade Jboss7 to Wildfly8. S3Ping supports in Wildfly8 or is there any other way I can achieve this configuration ?


Leave a Reply

Your email address will not be published. Required fields are marked *

− 6 = two

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">