redisson/redisson · error · CacheException
hibernate.cache.redisson.jndi_name property not set
Error message
hibernate.cache.redisson.jndi_name property not set
What it means
The reactive counterpart of getClusterConnection(): getReactiveClusterConnection() throws InvalidDataAccessResourceUsageException unless the Redisson Config uses ClusterServersConfig. Reactive cluster APIs (ReactiveRedisClusterConnection) require a real cluster topology.
Source
Thrown at redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java:45
/**
* Hibernate Cache region factory based on Redisson.
* Uses Redisson instance located in JNDI.
*
* @author Nikita Koksharov
*
*/
public class JndiRedissonRegionFactory extends RedissonRegionFactory {
private static final long serialVersionUID = -4814502675083325567L;
public static final String JNDI_NAME = CONFIG_PREFIX + "jndi_name";
@Override
protected RedissonClient createRedissonClient(Properties properties) {
String jndiName = ConfigurationHelper.getString(JNDI_NAME, properties);
if (jndiName == null) {
throw new CacheException(JNDI_NAME + " property not set");
}
Properties jndiProperties = JndiServiceImpl.extractJndiProperties(properties);
InitialContext context = null;
try {
context = new InitialContext(jndiProperties);
return (RedissonClient) context.lookup(jndiName);
} catch (NamingException e) {
throw new CacheException("Unable to locate Redisson instance by name: " + jndiName, e);
} finally {
if (context != null) {
try {
context.close();
} catch (NamingException e) {
throw new CacheException("Unable to close JNDI context", e);
}
}
}
View on GitHub (pinned to 91188987c2)
Solutions
- Use config.useClusterServers().addNodeAddress(...) when reactive cluster operations are needed.
- Branch on topology: use getReactiveConnection() for non-cluster deployments.
- Guard with redisson.getConfig().isClusterConfig() before requesting the reactive cluster connection.
Example fix
// before
ReactiveRedisClusterConnection c = factory.getReactiveClusterConnection(); // throws on single-server config
// after
ReactiveRedisConnection c = redisson.getConfig().isClusterConfig()
? factory.getReactiveClusterConnection()
: factory.getReactiveConnection(); Defensive patterns
Strategy: type-guard
Validate before calling
if (!redisson.getConfig().isClusterConfig()) {
ReactiveRedisConnection conn = factory.getReactiveConnection(); // safe fallback
} else {
ReactiveRedisClusterConnection conn = factory.getReactiveClusterConnection();
} Type guard
static boolean supportsReactiveCluster(Redisson redisson) {
return redisson.getConfig().isClusterConfig();
} Try / catch
catch (InvalidDataAccessResourceUsageException e) on getReactiveClusterConnection: fall back to getReactiveConnection() and non-cluster reactive APIs, or reconfigure for cluster.
Prevention
- Resolve the deployment mode once at startup and select the reactive connection type then.
- Avoid calling *ClusterConnection getters unconditionally in health checks.
- Use environment-driven config so local single-node runs never trigger cluster code paths.
When it happens
Trigger: Calling RedisConnectionFactory.getReactiveClusterConnection() (e.g. via ReactiveRedisTemplate cluster paths or reactor code using cluster node-specific ops) while Redisson is in single/sentinel/replicated mode.
Common situations: Reactive Spring Data Redis code deployed against non-cluster Redis; environment-dependent topologies (local single node vs prod cluster); health checks that open reactive cluster connections unconditionally.
Related errors
- Unable to update read-only object
- Redisson is not in Cluster mode
- Should be defined through Redisson Config object
- Redisson is not in Cluster mode
- Redisson is not in Cluster mode
AI-assisted analysis of redisson/redisson@91188987c2 (2026-08-14).
Data as JSON: /api/errors/811f6aae59b8b483.
Report an issue: GitHub.