{"record":{"id":"72aee19548a7650d","repo":"redisson/redisson","slug":"hibernate-cache-redisson-jndi-name-property-not-se-72aee1","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":"critical","filePath":"redisson-hibernate/redisson-hibernate-53/src/main/java/org/redisson/hibernate/JndiRedissonRegionNativeFactory.java","lineNumber":45,"sourceCode":"\n/**\n * Hibernate Cache region factory based on Redisson. \n * Uses Redisson instance located in JNDI.\n * \n * @author Nikita Koksharov \n *\n */\npublic class JndiRedissonRegionNativeFactory extends RedissonRegionNativeFactory {\n\n    private static final long serialVersionUID = -4814502675083325567L;\n\n    public static final String JNDI_NAME = CONFIG_PREFIX + \"jndi_name\";\n    \n    @Override\n    protected RedissonClient createRedissonClient(Map properties) {\n        String jndiName = ConfigurationHelper.getString(JNDI_NAME, properties);\n        if (jndiName == null) {\n            throw new CacheException(JNDI_NAME + \" property not set\");\n        }\n        \n        Properties jndiProperties = JndiServiceImpl.extractJndiProperties(properties);\n        InitialContext context = null;\n        try {\n            context = new InitialContext(jndiProperties);\n            return (RedissonClient) context.lookup(jndiName);\n        } catch (NamingException e) {\n            throw new CacheException(\"Unable to locate Redisson instance by name: \" + jndiName, e);\n        } finally {\n            if (context != null) {\n                try {\n                    context.close();\n                } catch (NamingException e) {\n                    throw new CacheException(\"Unable to close JNDI context\", e);\n                }\n            }\n        }","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/redisson/redisson/blob/91188987c2a9023e7fedabff758681ad9b107f25/redisson-hibernate/redisson-hibernate-53/src/main/java/org/redisson/hibernate/JndiRedissonRegionNativeFactory.java#L27-L63","documentation":"Thrown by JndiRedissonRegionNativeFactory (Hibernate 5.3 module, RMapCacheNative-backed regions) when the required hibernate.cache.redisson.jndi_name property is missing from the Hibernate configuration. Like its non-native twin (error 54) the factory fetches a pre-built RedissonClient from JNDI; with the property absent, ConfigurationHelper.getString returns null and startup fails fast with this CacheException before any JNDI work is attempted.","triggerScenarios":"Configuring hibernate.cache.region_factory_class=org.redisson.hibernate.JndiRedissonRegionNativeFactory without hibernate.cache.redisson.jndi_name, or with a misspelled key such as hibernate.cache.redisson.jndi-name.","commonSituations":"Adopting the native factory for Redis-side eviction but reusing properties written for the yaml-based RedissonRegionFactory; config split across files where the JNDI entry is forgotten in one profile.","solutions":["Add hibernate.cache.redisson.jndi_name=<name> with the exact underscore spelling to the same Hibernate configuration.","Double-check the value is the name the container actually binds the RedissonClient to.","If file-based config was intended, use RedissonRegionNativeFactory with redisson.yaml instead of the JNDI variant."],"exampleFix":"# before\nhibernate.cache.region_factory_class=org.redisson.hibernate.JndiRedissonRegionNativeFactory\n\n# after\nhibernate.cache.region_factory_class=org.redisson.hibernate.JndiRedissonRegionNativeFactory\nhibernate.cache.redisson.jndi_name=java:jboss/redisson","handlingStrategy":"validation","validationCode":"boolean nativeJndiConfigValid(java.util.Properties p) {\n    return \"org.redisson.hibernate.JndiRedissonRegionNativeFactory\".equals(\n               p.getProperty(\"hibernate.cache.region_factory_class\"))\n        == (p.getProperty(\"hibernate.cache.redisson.jndi_name\") != null);\n}","typeGuard":null,"tryCatchPattern":"try {\n    sessionFactory = cfg.buildSessionFactory();\n} catch (CacheException e) {\n    if (e.getMessage() != null && e.getMessage().endsWith(\"jndi_name property not set\")) {\n        // JNDI native factory selected but no name supplied — add the property\n    }\n    throw e;\n}","preventionTips":["Treat region_factory_class and jndi_name as one atomic config pair in templates.","Lint Hibernate properties in CI: selecting a Jndi* factory without jndi_name is an error."],"tags":["redisson","hibernate","jndi","configuration","startup"],"backgroundTag":null,"analyzedSha":"91188987c2a9023e7fedabff758681ad9b107f25","analyzedAt":"2026-08-14T11:39:42.619Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}