ClassNotFoundException: solr.FastLRUCache — Cache Class Removed in Solr 9

Errors

The Error

Your Opensolr Index fails to start or reload with:

org.apache.solr.common.SolrException: Error loading class 'solr.FastLRUCache'
Caused by: java.lang.ClassNotFoundException: solr.FastLRUCache

You may also see the same error for solr.LRUCache. Both are caused by the same thing.


What Is Actually Happening

SOLR CACHE CLASS MIGRATIONRemoved in Solr 9solr.FastLRUCachesolr.LRUCachereplaceUse Insteadsolr.CaffeineCacheSolr 9+ DefaultFaster, more modernW-TinyLFU evictionFind & replace all cache class references in your solrconfig.xmlThe fix is a simple text replacement — solr.FastLRUCache or solr.LRUCachebecomes solr.CaffeineCache everywhere. All parameters stay the same.

Starting with Solr 9, the old cache implementations solr.FastLRUCache and solr.LRUCache were removed entirely. They have been replaced by solr.CaffeineCache, which is faster, uses less memory, and has a smarter eviction algorithm (W-TinyLFU instead of plain LRU).

If your solrconfig.xml still references solr.FastLRUCache or solr.LRUCache, Solr cannot find the class and throws a ClassNotFoundException.

This typically happens when:

  • You copied a solrconfig.xml from an older Solr 7 or Solr 8 setup
  • You are upgrading an existing index configuration to a newer Solr version
  • You downloaded a solrconfig.xml template from an outdated tutorial or documentation

How to Fix It

Open your solrconfig.xml and find every cache definition that references the old class. Replace it with solr.CaffeineCache:

Before (broken)

<filterCache class="solr.FastLRUCache"
             size="512"
             initialSize="512"
             autowarmCount="0"/>

<queryResultCache class="solr.LRUCache"
                  size="512"
                  initialSize="512"
                  autowarmCount="0"/>

<documentCache class="solr.LRUCache"
               size="512"
               initialSize="128"/>

After (fixed)

<filterCache class="solr.CaffeineCache"
             size="512"
             initialSize="512"
             autowarmCount="0"/>

<queryResultCache class="solr.CaffeineCache"
                  size="512"
                  initialSize="512"
                  autowarmCount="0"/>

<documentCache class="solr.CaffeineCache"
               size="512"
               initialSize="128"/>

All existing parameters (size, initialSize, autowarmCount, etc.) remain the same — you only need to change the class attribute. solr.CaffeineCache accepts the same configuration parameters.


Quick Fix: Find & Replace

If you have access to your solrconfig.xml, do a simple find-and-replace:

Find Replace With
solr.FastLRUCache solr.CaffeineCache
solr.LRUCache solr.CaffeineCache

Upload the updated solrconfig.xml via your Opensolr Control Panel and reload your index.


Which Caches Are Affected?

Your solrconfig.xml may define any of these caches — check all of them:

Cache Name Purpose
filterCache Caches filter query results (e.g., fq=status:active)
queryResultCache Caches ordered lists of document IDs for repeated queries
documentCache Caches stored field values for retrieved documents
fieldValueCache Caches field values used for faceting

Every one of these should use class="solr.CaffeineCache" on Solr 9 and later.


Why Was FastLRUCache Removed?

CaffeineCache outperforms both old implementations in every metric:

solr.LRUCache solr.FastLRUCache solr.CaffeineCache
Concurrency Synchronized (blocking) Concurrent (non-blocking) Concurrent (non-blocking)
Eviction Strict LRU Approximate LRU W-TinyLFU (near-optimal)
Memory overhead Higher Medium Lower
Available in Solr 9+ No No Yes (default)

The migration is intentionally simple — same parameters, just a different class name.