Catalina cache warnings: Unable to add the resource to the cache

Issue
Apache Tomcat logs, e.g. logs/catalina.out continuously report:

Unable to add the resource to the cache
Insufficient free space available after evicting expired cache entries
Consider increasing the maximum size of the cache
21-Nov-2019 14:33:17.211 WARNING [http-nio-80-exec-4] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/WEB-INF/plugins/dockerhub-notification.hpi] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
Tomcat >= 8


Resolution
Note: Apache Tomcat 8.5 support ended on 2019-10-31.

Increase the cache size parameter.
Add/edit cacheMaxSize within the Context XML element of your $CATALINA_BASE/conf/context.xml.
The Resources component inside the <Context block should fix the issue, see https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html

<Resources
cachingAllowed="true"
cacheMaxSize="100000"
/>


The value may be changed while the web application is running (e.g. via JMX). Increasing the cacheMaxSize value should clean up the cache warnings you were noticing.

An alternative approach would be to completely disable cache


<Resources
cachingAllowed="false"
/>
  • catalina, cache warnings, unable to add the resource to the cache
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

 How to find the correct Java Heap Settings for your Server

By default Tomcat is configured to use a minimum of 64 MB of RAM and a maximum of 128 MB of RAM...

 Tomcat Native library which allows optimal performance in production environments was not found

In the default tomcat deployment, you may see this error in regard to missing tomcat native...

 Tomcat SSL without keystore

Starting from tomcat8 we can configure the tomcat SSL protocol without the need of a keystore.It...

 Importing an SSL certificate into the keystore

In this short tutorial we will present how to import a pem certificate into a pfx and then into a...

 Increase memory allocation in tomcat

To increase memory allocation in tomcat you need to: configure the following in the...