Web Application session replication is enabled in a clustered environment from WSO2 Application Server 5.0.0. Therefore, when a Web application is defined as "distributable" and once a session is created for it from a node, that session gets replicated to other nodes as well. The subsequent changes in the session from any node will also get replicated to other nodes. The same session replication mechanism from Tomcat ( ) is used here, except for the Axis2 Tribes Framework used to send the session replication messages across the cluster.
There are some custom changes required to enable this session replication from Tomcat to WSO2 Carbon. For example, WSO2 has developed its own TomcatValve to start the session replication process and own implementation of ClusterableSessionManager, which is responsible for handling session for a distributable Web application and sending session replication messages.
Follow the instructions below to enable session replication in a WSO2 Application Server cluster.
1) First enable clustering in Axis2. We also have to enable clustering for Catalina engine by adding the following in between <Engine></Engine> in catalina-server.xml.
2) Add the following TomcatValve for <Host> which is responsible for starting the replication of session. This should be the first of the Tomcat valves.
3) Make the Web application distributable by defining the property "<distributable/>" in web.xml. Then, deploy it in the Application Server.
The above steps should also be implemented for other Application Server nodes in the cluster for which session replication should be enabled. These steps are the standard steps for session replication in a standalone tomcat cluster environment.