{"record":{"id":"811f6aae59b8b483","repo":"redisson/redisson","slug":"hibernate-cache-redisson-jndi-name-property-not-se-811f6a","errorCode":null,"errorMessage":"hibernate.cache.redisson.jndi_name property not set","messagePattern":"hibernate\\.cache\\.redisson\\.jndi_name property not set","errorType":"exception","errorClass":"CacheException","httpStatus":null,"severity":"error","filePath":"redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java","lineNumber":45,"sourceCode":"\r\n/**\r\n * Hibernate Cache region factory based on Redisson. \r\n * Uses Redisson instance located in JNDI.\r\n * \r\n * @author Nikita Koksharov \r\n *\r\n */\r\npublic class JndiRedissonRegionFactory extends RedissonRegionFactory {\r\n\r\n    private static final long serialVersionUID = -4814502675083325567L;\r\n\r\n    public static final String JNDI_NAME = CONFIG_PREFIX + \"jndi_name\";\r\n    \r\n    @Override\r\n    protected RedissonClient createRedissonClient(Properties properties) {\r\n        String jndiName = ConfigurationHelper.getString(JNDI_NAME, properties);\r\n        if (jndiName == null) {\r\n            throw new CacheException(JNDI_NAME + \" property not set\");\r\n        }\r\n        \r\n        Properties jndiProperties = JndiServiceImpl.extractJndiProperties(properties);\r\n        InitialContext context = null;\r\n        try {\r\n            context = new InitialContext(jndiProperties);\r\n            return (RedissonClient) context.lookup(jndiName);\r\n        } catch (NamingException e) {\r\n            throw new CacheException(\"Unable to locate Redisson instance by name: \" + jndiName, e);\r\n        } finally {\r\n            if (context != null) {\r\n                try {\r\n                    context.close();\r\n                } catch (NamingException e) {\r\n                    throw new CacheException(\"Unable to close JNDI context\", e);\r\n                }\r\n            }\r\n        }\r","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/redisson/redisson/blob/91188987c2a9023e7fedabff758681ad9b107f25/redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java#L27-L63","documentation":"The reactive counterpart of getClusterConnection(): getReactiveClusterConnection() throws InvalidDataAccessResourceUsageException unless the Redisson Config uses ClusterServersConfig. Reactive cluster APIs (ReactiveRedisClusterConnection) require a real cluster topology.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nReactiveRedisClusterConnection c = factory.getReactiveClusterConnection(); // throws on single-server config\n\n// after\nReactiveRedisConnection c = redisson.getConfig().isClusterConfig()\n        ? factory.getReactiveClusterConnection()\n        : factory.getReactiveConnection();","handlingStrategy":"type-guard","validationCode":"if (!redisson.getConfig().isClusterConfig()) {\n    ReactiveRedisConnection conn = factory.getReactiveConnection(); // safe fallback\n} else {\n    ReactiveRedisClusterConnection conn = factory.getReactiveClusterConnection();\n}","typeGuard":"static boolean supportsReactiveCluster(Redisson redisson) {\n    return redisson.getConfig().isClusterConfig();\n}","tryCatchPattern":"catch (InvalidDataAccessResourceUsageException e) on getReactiveClusterConnection: fall back to getReactiveConnection() and non-cluster reactive APIs, or reconfigure for cluster.","preventionTips":["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."],"tags":["redis","redisson","cluster","reactive","configuration","connection-factory"],"backgroundTag":null,"analyzedSha":"91188987c2a9023e7fedabff758681ad9b107f25","analyzedAt":"2026-08-14T11:39:42.619Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}