rediswebsphere-libertyredissonjcache

WebSphere Liberty integration with Redis for HTTP Session Persistence


We are trying to replace WebSphere Extremescape in our environment and planning to use redis. The only reason we are using WebSphere extremescale is to provide HTTP session persistence. I believe we can use jcache/redisson to have WebSphere Liberty use redis for session persistence. Has anyone done that - if yes, would you please share your configuration for redisson-jcache.yaml and server.xml configuration

Thanks,

Here is the stack trace

[3/27/24 1:04:12:216 UTC] 0000002b com.ibm.ws.logging.internal.impl.IncidentImpl              
I FFDC1015I: An FFDC Incident has been created: "java.lang.IllegalStateException: 
Default configuration hasn't been specified! com.ibm.ws.session.store.cache.CacheHashMap 250" at ffdc_24.03.27_01.04.11.0.log
[3/27/24 1:04:12:218 UTC] 0000002b com.ibm.ws.session.store.cache.CacheHashMap                 
 E SESN0307E: An exception occurred when initializing the cache.
 The exception is: java.lang.IllegalStateException: Default configuration hasn't been specified!
        at org.redisson.jcache.JCacheManager.createCache(JCacheManager.java:119)
        at com.ibm.ws.session.store.cache.CacheHashMap.cacheInit(CacheHashMap.java:192)
        at com.ibm.ws.session.store.cache.CacheHashMap.lambda$new$0(CacheHashMap.java:136)
        at java.security.AccessController.doPrivileged(AccessController.java:690)
        at com.ibm.ws.session.store.cache.CacheHashMap.<init>(CacheHashMap.java:135)
        at com.ibm.ws.session.store.cache.CacheStore.<init>(CacheStore.java:35)
        at com.ibm.ws.session.store.cache.CacheStoreService.createStore(CacheStoreService.java:323)
        at com.ibm.ws.session.SessionContext.createStore(SessionContext.java:355)
        at com.ibm.ws.session.SessionContext.createStore(SessionContext.java:344)
        at com.ibm.ws.session.SessionContext.createCoreSessionManager(SessionContext.java:257)
        at com.ibm.ws.session.SessionContext.createCoreSessionManager(SessionContext.java:190)
        at com.ibm.ws.webcontainer.session.impl.HttpSessionContextImpl.createCoreSessionManager(HttpSessionContextImpl.java:963)
        at com.ibm.ws.session.SessionContext.<init>(SessionContext.java:160)
        at com.ibm.ws.session.SessionContext.<init>(SessionContext.java:145)
        at com.ibm.ws.webcontainer.session.impl.HttpSessionContextImpl.<init>(HttpSessionContextImpl.java:61)
        at com.ibm.ws.webcontainer.session.impl.SessionContextRegistryImpl.createSessionContextObject(SessionContextRegistryImpl.java:98)
        at com.ibm.ws.webcontainer.session.impl.SessionContextRegistryImpl.createSessionContext(SessionContextRegistryImpl.java:86)
        at com.ibm.ws.webcontainer.session.impl.SessionContextRegistryImpl.getSessionContext(SessionContextRegistryImpl.java:309)
        at com.ibm.ws.webcontainer.WebContainer.getSessionContext(WebContainer.java:707)
        at com.ibm.ws.webcontainer.VirtualHost.getSessionContext(VirtualHost.java:190)
        at com.ibm.ws.webcontainer.webapp.WebGroup.getSessionContext(WebGroup.java:158)
        at com.ibm.ws.webcontainer.webapp.WebApp.createSessionContext(WebApp.java:1344)
        at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationStart(WebApp.java:1327)
        at com.ibm.ws.webcontainer.osgi.webapp.WebApp.commonInitializationStart(WebApp.java:256)
        at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1039)
        at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6705)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:474)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:469)
        at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1197)
        at com.ibm.ws.webcontainer.osgi.WebContainer.access$100(WebContainer.java:112)
        at com.ibm.ws.webcontainer.osgi.WebContainer$3.run(WebContainer.java:994)
        at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:247)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:522)
        at java.util.concurrent.FutureTask.run(FutureTask.java:277)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.lang.Thread.run(Thread.java:825)
.

Solution

  • Ok so just to briefly summarize the other answer:

    Add feature:

    <feature>sessionCache-1.0</feature>
    

    Define library:

    <library id="jCacheVendorLib">
      <fileset dir="${shared.resource.dir}/redisson" includes="*"/>
    </library>
    

    Use library in cache config:

        <httpSessionCache libraryRef="jCacheVendorLib"
                          uri="file:${shared.resource.dir}/redisson/redisson-jcache.yaml" />
    

    Contents of the redisson-jcache.yaml:

    clusterServersConfig:
      password: ${clusterServerConfig.password}
      nodeAddresses:
      - ${clusterServerConfig.nodeAddresses}