{"record":{"id":"86c49dd92c8b822f","repo":"hibernate/hibernate-orm","slug":"unable-to-call-constructor-of-regionfactory-impl","errorCode":null,"errorMessage":"Unable to call constructor of RegionFactory impl [","messagePattern":"Unable to call constructor of RegionFactory impl \\[","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/cache/internal/StrategyCreatorRegionFactoryImpl.java","lineNumber":45,"sourceCode":"\tpublic RegionFactory create(Class<? extends RegionFactory> strategyClass) {\n\t\tassert RegionFactory.class.isAssignableFrom( strategyClass );\n\n\t\t// first look for a constructor accepting Properties\n\t\tfinal var regionFactoryWithProperties = instantiateWithProperties( strategyClass, Properties.class );\n\t\tif ( regionFactoryWithProperties != null ) {\n\t\t\treturn regionFactoryWithProperties;\n\t\t}\n\t\t// next try Map\n\t\tfinal var regionFactoryWithMap = instantiateWithProperties( strategyClass, Map.class );\n\t\tif ( regionFactoryWithMap != null ) {\n\t\t\treturn regionFactoryWithMap;\n\t\t}\n\t\t// finally try no-arg\n\t\ttry {\n\t\t\treturn strategyClass.newInstance();\n\t\t}\n\t\tcatch (IllegalAccessException | InstantiationException e) {\n\t\t\tthrow new ServiceException( \"Unable to call constructor of RegionFactory impl [\" + strategyClass.getName() + \"]\", e );\n\t\t}\n\t}\n\n\tprivate RegionFactory instantiateWithProperties(Class<? extends RegionFactory> strategyClass, Class<?> propertiesClass) {\n\t\ttry {\n\t\t\treturn strategyClass.getConstructor( propertiesClass ).newInstance( properties );\n\t\t}\n\t\tcatch ( NoSuchMethodException e ) {\n\t\t\treturn null;\n\t\t}\n\t\tcatch (IllegalAccessException | InstantiationException | InvocationTargetException e) {\n\t\t\tthrow new ServiceException( \"Unable to call constructor of RegionFactory impl [\" + strategyClass.getName() + \"]\", e );\n\t\t}\n\t}\n}\n","sourceCodeStart":27,"sourceCodeEnd":61,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/cache/internal/StrategyCreatorRegionFactoryImpl.java#L27-L61","documentation":"Error \"Unable to call constructor of RegionFactory impl [\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Second-level caching is misconfigured or a cache region/key does not match what Hibernate expects.","commonSituations":"Enabling @Cacheable entities without setting hibernate.cache.region.factory_class, custom RegionFactory implementations, or unwrapping Cache to provider types.","solutions":["Give the RegionFactory implementation a public no-arg (or (Properties)) constructor and inspect the wrapped cause."],"exampleFix":"Give the RegionFactory implementation a public no-arg (or (Properties)) constructor and inspect the wrapped cause.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}