1

I am trying to make the redis sentinel pods in my cluster as my L2 cache for hibernate JPA.

I am using wildfly 32.0.1.Final server with my deployment structure having a ear with a lib and a META-INF folder and many subdeployment jars and wars. In some of the jars I am using hibernate JPA as persistence provider and have these properties in my persistence.xml file :

    <properties>
        <property name="hibernate.type.json_format_mapper" value="jsonb" />
        <property name="hibernate.type.xml_format_mapper" value="jaxb" />

        <property name="hibernate.generate_statistics" value="true"/>
        
        <property name="hibernate.cache.region.factory_class" value="org.redisson.hibernate.RedissonRegionFactory" />
        <property name="hibernate.cache.redisson.config" value="/redisson.yaml" />

    </properties>

I have added the following jars and redisson.yaml in my ear/lib folder : redisson-3.52.0.jar, redisson-hibernate-6-3.52.0.jar.

This is my dummy redisson.yaml which I have taken from redisson website:

---
sentinelServersConfig:
  idleConnectionTimeout: 10000
  connectTimeout: 10000
  timeout: 3000
  retryAttempts: 4
  retryDelay: !<org.redisson.config.EqualJitterDelay> {baseDelay: PT1S, maxDelay: PT2S}
  reconnectionDelay: !<org.redisson.config.EqualJitterDelay> {baseDelay: PT0.1S, maxDelay: PT10S}
  failedSlaveReconnectionInterval: 3000
  failedSlaveNodeDetector: !<org.redisson.client.FailedConnectionDetector> {}
  password: <password>
  subscriptionsPerConnection: 5
  clientName: <clientName>
  loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
  subscriptionConnectionMinimumIdleSize: 1
  subscriptionConnectionPoolSize: 50
  slaveConnectionMinimumIdleSize: 24
  slaveConnectionPoolSize: 64
  masterConnectionMinimumIdleSize: 24
  masterConnectionPoolSize: 64
  readMode: "MASTER"
  subscriptionMode: "SLAVE"
  sentinelAddresses:
    - "redis://<serviceName>:<port>"
  masterName: "ccspredis"
  database: 0
threads: 16
nettyThreads: 32
codec: !<org.redisson.codec.Kryo5Codec> {}
transportMode: "NIO"

I am getting these logs regarding the L2 cache for persistence units :

09:48:21,387 INFO  [org.hibernate.cache.internal.RegionFactoryInitiator] (ServerService Thread Pool -- 79) HHH000025: Second-level cache region factory [org.redisson.hibernate.RedissonRegionFactory]
09:48:21,387 INFO  [org.hibernate.cache.internal.RegionFactoryInitiator] (ServerService Thread Pool -- 80) HHH000025: Second-level cache region factory [org.redisson.hibernate.RedissonRegionFactory]
09:48:21,387 INFO  [org.hibernate.cache.internal.RegionFactoryInitiator] (ServerService Thread Pool -- 78) HHH000025: Second-level cache region factory [org.redisson.hibernate.RedissonRegionFactory]
09:48:21,387 INFO  [org.hibernate.cache.internal.RegionFactoryInitiator] (ServerService Thread Pool -- 81) HHH000025: Second-level cache region factory [org.redisson.hibernate.RedissonRegionFactory]
09:48:21,387 INFO  [org.hibernate.cache.internal.RegionFactoryInitiator] (ServerService Thread Pool -- 82) HHH000025: Second-level cache region factory [org.redisson.hibernate.RedissonRegionFactory]
09:48:21,437 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 80) Envers integration enabled? : true
09:48:21,437 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 81) Envers integration enabled? : true
09:48:21,437 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 79) Envers integration enabled? : true
09:48:21,437 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 78) Envers integration enabled? : true
09:48:21,437 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 82) Envers integration enabled? : true
09:48:21,542 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 78) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'myEar.ear/devPersistence1.jar#pobj1EM'
09:48:21,542 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 82) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'myEar.ear/devPersistence2.jar#pobj2EM'
09:48:21,542 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 79) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'myEar.ear/devPersistence3.war#pobj1EM'
09:48:21,542 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 80) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'myEar.ear/devPersistence4.jar#pobj1EM'
09:48:21,542 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 81) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'myEar.ear/devPersistence5.jar#pobj1EM'
...
09:48:21,728 INFO  [stdout] (ServerService Thread Pool -- 80) 2025-11-06 09:48:21.721 [] [] [ServerService Thread Pool -- 80] [ERROR] Config:666 - JSON configuration is deprecated and will be removed in future!
09:48:21,728 INFO  [stdout] (ServerService Thread Pool -- 80) 2025-11-06 09:48:21.721 [] [] [ServerService Thread Pool -- 81] [ERROR] Config:666 - JSON configuration is deprecated and will be removed in future!
09:48:21,729 INFO  [stdout] (ServerService Thread Pool -- 79) 2025-11-06 09:48:21.721 [] [] [ServerService Thread Pool -- 79] [ERROR] Config:666 - JSON configuration is deprecated and will be removed in future!
09:48:21,729 INFO  [stdout] (ServerService Thread Pool -- 81) 2025-11-06 09:48:21.721 [] [] [ServerService Thread Pool -- 82] [ERROR] Config:666 - JSON configuration is deprecated and will be removed in future!
09:48:21,731 INFO  [stdout] (ServerService Thread Pool -- 80) 2025-11-06 09:48:21.730 [] [] [ServerService Thread Pool -- 80] [ERROR] Config:659 - JSON configuration is deprecated and will be removed in future!
09:48:21,731 INFO  [stdout] (ServerService Thread Pool -- 81) 2025-11-06 09:48:21.730 [] [] [ServerService Thread Pool -- 81] [ERROR] Config:659 - JSON configuration is deprecated and will be removed in future!
09:48:21,731 INFO  [stdout] (ServerService Thread Pool -- 82) 2025-11-06 09:48:21.730 [] [] [ServerService Thread Pool -- 82] [ERROR] Config:659 - JSON configuration is deprecated and will be removed in future!
09:48:21,731 INFO  [stdout] (ServerService Thread Pool -- 79) 2025-11-06 09:48:21.730 [] [] [ServerService Thread Pool -- 79] [ERROR] Config:659 - JSON configuration is deprecated and will be removed in future!
09:48:21,871 INFO  [stdout] (ServerService Thread Pool -- 78) 2025-11-06 09:48:21.871 [] [] [ServerService Thread Pool -- 78] [ERROR] Config:666 - JSON configuration is deprecated and will be removed in future!
09:48:21,871 INFO  [stdout] (ServerService Thread Pool -- 78) 2025-11-06 09:48:21.871 [] [] [ServerService Thread Pool -- 78] [ERROR] Config:659 - JSON configuration is deprecated and will be removed in future!

But after I try to retrieve some entity from database I get this error :

java.lang.NullPointerException: Cannot invoke "org.redisson.api.RedissonClient.getScript(org.redisson.client.codec.Codec)" because "this.redisson" is null

I have tried finding solution and it seems that redisson.yaml is not being found and the "json configuration is deprecated and will be removed in future" logs is the fallback log if the redisson.yaml file is not found. I have already tried to move the redisson.yaml file to ear/META-INF and to the jars META-INF folder as well but nothing seems to be working.

Is there a reason why redisson.yaml is not being found and how to solve this issue?

1 Answer 1

1

I found that wildfly classloader only adds files from deployed EAR's lib folder when they are packaged as jars. So I created a redis-config.jar which only contains redisson.yaml. After that the redisson.yaml was getting discovered.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.