3

I am running Apache Tomcat/9.0.19 and recently I have noticed a lot of warning messages on the catalina.out log.

WARNING [main] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/WEB-INF/classes/static/maps/scripts/app-72be477367.js.map] to the cache for web application [##01] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

WARNING [main] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/WEB-INF/classes/static/maps/scripts/app-f223be6846.js.map] to the cache for web application [##01] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

Adding the following line to the conf/context.xml solves this problem and my log is no longer flooded.

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

How do I know what is the correct entry for my cacheMaxSize. Am I over-allocating space to cache.

Abhinav Anand
  • 41
  • 1
  • 5

1 Answers1

0

I had the same problem and was able to fix it, but there was an extra step for me, because I am running a server inside the Eclipse IDE, not stand alone on my PC.

Besides allocating a decent about of space for the cache, you must make sure you fix the right server. I made the mistake of fixing the tomcat server on my PC. Wrong! I eventually realized the Eclipse makes it's own copy of the tomcat server. I had to go into the eclipse- workspace-Servers directory and fix THAT copy of tomcat v 9.0.

I'll take a shot at your question about what size. It seems to make sense that you need to look at the size of the web site being presented and use that as the minimum size for the cache. Keeping in mind that a website could pull in a good amount of extra software from the server disk(s) or else where, you may want to add extra space. The best size to use is trail and error, although you could go through all the website code and expected usage and make calculations at how much memory will be used. Anyway, I just guessed. The total disk space for the website I'm using is only 22 M-bytes, so the cache size of 100000, i.e. 100 M-bytes seemed ok and I used that and it worked. I have plenty of memory space on my PC so that was not an issue for me.

Jim
  • 27
  • 5