Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenLiberty httpSessionCache configuration server.xml #5814

Open
mxcd opened this issue Apr 25, 2024 · 3 comments
Open

OpenLiberty httpSessionCache configuration server.xml #5814

mxcd opened this issue Apr 25, 2024 · 3 comments

Comments

@mxcd
Copy link

mxcd commented Apr 25, 2024

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

@mxcd mxcd added the question label Apr 25, 2024
@mrniko
Copy link
Member

mrniko commented Apr 28, 2024

Can you use env variables instead described in "Environmental variables" section ? https://github.com/redisson/redisson/wiki/2.-Configuration#221-yaml-file-based-configuration

@mrniko mrniko closed this as completed Apr 29, 2024
@mxcd
Copy link
Author

mxcd commented Apr 29, 2024

Hi @mrniko
Indeed directly stating the env variables in the YAML configuration file worked. It didn't occur to me since I was focused on using the open liberty server.xml variables.
Thanks for the support

@mrniko mrniko added the feature label Apr 29, 2024
@mrniko mrniko reopened this Apr 29, 2024
@mrniko
Copy link
Member

mrniko commented Apr 29, 2024

Hi,

I considered this issue as a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants