For JBoss AS 7.1 or EAP 6.1, clustering can be done quite easily with few modifications when startup.

JBoss AS uses infinispan (Memory data grid) to store sessions which will be loaded when necessary only, for example, when deployment is done.

You can either setup cluster via Domain or using Multiple standalone servers

Domain

Update domain configuration (/domain/configuration/domain.xml) to use “ha” as its profile.

<server-group name=”main-server-group” profile=”ha”>

Multiple Standalone servers

Use standalone-full-ha.xml profile to startup the servers.

/bin/standalone.sh -server-config standalone-full-ha.xml

Application

Include “<distributable/>” tag in application web.xml.

Troubleshooting

after the deployment has been done on both servers you should see infinispan log say that new member has bee found. If it does not, check your configuration.