I've tried to implement a high availability service with JBoss and Apache.

The architecture is:

|         |
|         |
JBoss1 JBoss2 

There is a balancer implemented from Apache to the JBoss'es, and it's working fine. Sometimes the request is taken by JBoss1, and sometimes by JBoss2, however if some Jboss goes down, the balancer still sends requests to it, so the application sometimes works and sometimes doesn't.

How can I implement a service which detects that if some JBoss is down, it automatically redirects the traffic to the other node?

I tried with hearbeat, but I can't solve it.


It is a built-in feature of mod_proxy+mod_proxy_balancer or mod_jk.

They rely on AJP protocol : https://community.jboss.org/wiki/UsingModproxyWithJBoss

Just follow this tutorial.

Here an example of Apache HTTP configuration :

<VirtualHost *:80>

    ServerName web-gui-acceptance.myorg.com
    ServerAlias web-gui-acceptance

    ProxyRequests Off
    ProxyPass /web-gui balancer://jbosscluster/web-gui stickysession=JSESSIONID nofailover=On
    ProxyPassReverse /web-gui http://srvlnx01.myorg.com:8080/web-gui
    ProxyPassReverse /web-gui http://srvlnx02.myorg.com:8080/web-gui

    <Proxy *>
      AuthType Kerberos

    <Proxy balancer://jbosscluster>
        BalancerMember ajp://srvlnx01.myorg.com:8009 route=SRVLNX01_node1
        BalancerMember ajp://srvlnx01.myorg.com:8009 route=SRVLNX02_node1
        ProxySet lbmethod=byrequests


And for each JBoss instances :

vi $JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="SRVLNX01_node1">

You can also take a look to HA Proxy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.