Session replication using Database persistence in Jboss 7.0.7
srpaluri Dec 8, 2018 1:14 PMWe have a HA cluster configured using Apache as Webserver and Jboss EAP 7.0.7 as the Application server. cluster has 2 nodes. Database is Oracle 12c
We configured Data source and WEB cache-container in standalone-full-ha.xml as below.
1. <datasource jndi-name="java:/jbsessionds" pool-name="jbsessionds" enabled="true">
<connection-url>jdbc:oracle:thin:@HOST:PORT/SID</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>500</max-pool-size>
</pool>
<security>
<user-name>jbsession</user-name>
<password>jbsession</password>
</security>
</datasource>
<driver name="oracle" module="DBDRIVER">
<xa-datasource-class>oracle.jdbc.driver.OracleDriver</xa-datasource-class>
</driver>
2. User jbsession created in Database as below:
CREATE USER jbsession IDENTIFIED BY jbsession;
GRANT CONNECT TO jbsession;
GRANT CONNECT, RESOURCE, DBA TO jbsession;
GRANT CREATE SESSION TO jbsession with admin OPTION;
3. <cache-container name="web" default-cache="database" module="org.jboss.as.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<local-cache name="database">
<binary-keyed-jdbc-store data-source="jbsessionds" dialect="ORACLE" purge="false" shared="true" singleton="false">
<binary-keyed-table prefix="JBSESSION">
<id-column name="id" type="VARCHAR2(500)"/>
<data-column name="datum" type="BLOB"/>
<timestamp-column name="version" type="NUMBER"/>
</binary-keyed-table>
</binary-keyed-jdbc-store>
</local-cache>
</cache-container>
After restarting the Jboss server, there were no errors observed in the server.log related to the above changes. Tables were created in Database for the applications installed in our Application server as follows:
JBSESSION_Application1_war
JBSESSION_Application2_war
and so on..
and could see some sessions for user JBSESSION in GV$sessions table.
But when i login to my application and create sessions, i do not see any entries in any of the tables mentioned above and when i try to validate the session replication scenario, by stopping the Jboss node in which the session is created, fail over is not happening. (since session data is not getting persisted)
I believe i'm missing some thing in terms of Data source or the cache-container configuration or both. With distributed mode we are able to achieve session replication, so i doubt there is anything missing from application perspective.
Appreciate any inputs in this regard.