OpenLiberty httpSessionCache configuration server.xml

Open
#5,814 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
java, redis

Research direction

Start with the linked Open Liberty httpSessionCache reference and the server.xml and redis-config.yaml examples in the report. Determine how Redisson JCache vendor-specific properties are passed and whether environment-based values are supported; the documentation is complete when it gives an accurate configuration example or clearly states the limitation.

Written by the indexing model from the issue text.

Description

feature question

I am trying to use redisson as jCache implementation for the httpSessionCache of my open liberty server.
So far, I've managed to use the library by providing a configuration yaml file like so:

<!-- server.xml -->
<library id="jCacheVendorLib">
    <fileset dir="${shared.resource.dir}" includes="*"/>
    <folder dir="${shared.resource.dir}" />
  </library>
<httpSessionCache libraryRef="jCacheVendorLib" uri="file:${server.config.dir}/redis-config.yaml" />

My goal is to provide the redis uri and password using environment variables. The open liberty docs state, that I should be able to provide a "list of vendor-specific JCache configuration properties, which are passed to the JCache provider when the CacheManager is obtained" (see here )
My naive approach was to provide those properties with the same keys as I would in the yaml file:

<!-- server.xml -->
  <variable name="redis.uri" defaultValue="redis://localhost:6379"/>
  <variable name="redis.password" defaultValue=""/>

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

  <httpSessionCache libraryRef="jCacheVendorLib">
    <properties singleServerConfig.address="${redis.uri}"/>
    <properties singleServerConfig.password="${redis.password}"/>
  </httpSessionCache>

This unfortunately failed with

[INFO] [ERROR   ] SESN0307E: An exception occurred when initializing the cache. The exception is: java.lang.IllegalStateException: Default configuration hasn't been specified!
[INFO] 	at org.redisson.jcache.JCacheManager.createCache(JCacheManager.java:119)
[INFO] 	at com.ibm.ws.session.store.cache.CacheHashMap.cacheInit(CacheHashMap.java:192)
[INFO] 	at [internal classes]

Is this approach feasible or is there another way of achieving an environment variable based configuration?
Is there some piece of documentation specifying the "vendor-specific JCache configuration properties"?

Thanks a lot
Max

Dominant language
Java
Stars
24.4k
Forks
5.5k
Avg merge
2d 5h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from redisson/redisson

All issues in redisson/redisson

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.