Sunday, October 14, 2012

Session Replication in JBOSS


We need to edit some configuration files to achieve session replication.
First go to the application web.xml file then add <distributable/> tag inside the <web-app> tag.
Then open the jboss-web.xml file and add following tag inside the <jboss-web> tag.


<replication-config>
        <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
        <replication-granularity>SESSION</replication-granularity>
        <replication-field-batch-mode>true</replication-field-batch-mode>
    </replication-config>

Then we need to edit some configuration files in the server. So we need to add jvmroute to server.xml file. Open the server.xml file located in {JBOSS_HOME}\server\node1\deploy\jbossweb.sar\server.xml. 
Find following tag.

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

Then change it as follows.

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

Then uncomment following tag in the server.xml file.

<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />

Do these changes for all the nodes of the cluster. 
Now we completed session replication part also.. 
Cheers.. :)

No comments:

Post a Comment