{"record":{"id":"9fd45d0d539d1713","repo":"apache/cassandra","slug":"cannot-find-configured-row-cache-provider-class","errorCode":null,"errorMessage":"Cannot find configured row cache provider class ${DatabaseDescriptor.getRowCacheClassName()}","messagePattern":"Cannot find configured row cache provider class (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/service/CacheService.java","lineNumber":158,"sourceCode":"     */\n    private AutoSavingCache<RowCacheKey, IRowCacheEntry> initRowCache()\n    {\n        logger.info(\"Initializing row cache with capacity of {} MiBs\", DatabaseDescriptor.getRowCacheSizeInMiB());\n\n        CacheProvider<RowCacheKey, IRowCacheEntry> cacheProvider;\n        String cacheProviderClassName = DatabaseDescriptor.getRowCacheSizeInMiB() > 0\n                                        ? DatabaseDescriptor.getRowCacheClassName() : \"org.apache.cassandra.cache.NopCacheProvider\";\n        try\n        {\n            Class<? extends CacheProvider> cacheProviderClass =\n                FBUtilities.classForNameWithoutInitialization(cacheProviderClassName, \"row cache provider\", CacheProvider.class);\n            @SuppressWarnings(\"unchecked\")\n            CacheProvider<RowCacheKey, IRowCacheEntry> typedCacheProvider = cacheProviderClass.newInstance();\n            cacheProvider = typedCacheProvider;\n        }\n        catch (Exception e)\n        {\n            throw new RuntimeException(\"Cannot find configured row cache provider class \" + DatabaseDescriptor.getRowCacheClassName());\n        }\n\n        // cache object\n        ICache<RowCacheKey, IRowCacheEntry> rc = cacheProvider.create();\n        AutoSavingCache<RowCacheKey, IRowCacheEntry> rowCache = new AutoSavingCache<>(rc, CacheType.ROW_CACHE, new RowCacheSerializer());\n\n        int rowCacheKeysToSave = DatabaseDescriptor.getRowCacheKeysToSave();\n\n        rowCache.scheduleSaving(DatabaseDescriptor.getRowCacheSavePeriod(), rowCacheKeysToSave);\n\n        return rowCache;\n    }\n\n    private AutoSavingCache<CounterCacheKey, ClockAndCount> initCounterCache()\n    {\n        logger.info(\"Initializing counter cache with capacity of {} MiBs\", DatabaseDescriptor.getCounterCacheSizeInMiB());\n\n        long capacity = DatabaseDescriptor.getCounterCacheSizeInMiB() * 1024 * 1024;","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/CacheService.java#L140-L176","documentation":"CacheService.initRowCache reflectively instantiates the configured row cache provider class (DatabaseDescriptor.getRowCacheClassName()). If instantiation fails for any reason (class missing, wrong type, constructor exception), it throws RuntimeException naming the configured class, swallowing the underlying cause.","triggerScenarios":"Node startup with row_cache_class_in (or equivalent) set to a class that is not on the classpath, does not implement CacheProvider<RowCacheKey, IRowCacheEntry>, or fails in its no-arg constructor/newInstance.","commonSituations":"Typos in the fully-qualified class name in cassandra.yaml; custom cache provider JAR not shipped with the node; provider compiled against an incompatible Cassandra version.","solutions":["Correct row_cache_class_in in cassandra.yaml or remove it to use the default provider","Ensure the provider class JAR is on the classpath of every node","Verify the class implements CacheProvider<RowCacheKey, IRowCacheEntry> and has a public no-arg constructor","Check server logs for the suppressed cause of the newInstance() failure"],"exampleFix":"// cassandra.yaml\n// before\nrow_cache_class_in: org.example.MyCacheProvider\n// after\nrow_cache_class_in: org.apache.cassandra.cache.OHCProvider","handlingStrategy":"try-catch","validationCode":"String cls = DatabaseDescriptor.getRowCacheClassName();\ntry { Class.forName(cls); }\ncatch (ClassNotFoundException e) { throw new IllegalStateException(\"Row cache provider not on classpath: \" + cls); }","typeGuard":null,"tryCatchPattern":"try { cacheService.initRowCache(); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Cannot find configured row cache provider\")) { /* revert to default OHCProvider and rethrow with cause */ } throw e; }","preventionTips":["Validate custom cache provider class names at config-load time with Class.forName","Ship custom provider JARs with the node image and verify on startup","Avoid swallowing the reflectiveInstantiationException cause when wrapping"],"tags":["cache","configuration","reflection","startup"],"backgroundTag":"class-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}