Tomcat cacheMaxSize
- When using Tomcat 8 with project containing many JARs (like Spring), we may see the warning logs:
org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [***] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
This is commonly seen in Tomcat 8.
- Reason[1] is:
- “Tomcat caches classes, JAR files, HTML, JSPs and any other files that contribute to the web application”
- “The total cache size (cacheMaxSize) is 10240kb and de maximum object size (cacheObjectMaxSize) is 512kb” by default
- Solution[2] is (if you are using Eclipse):
- in the Eclipse workspace, you should be able to find a Servers folder; find the Tomcat 8’s folder
- inside it, find the context.xml file for Tomcat 8
- add this before </context> tag
<Resources cachingAllowed="true" cacheMaxSize="100000" />
- restart Eclipse, hopefully you should find the problem solved
Other Notes
- To access form data (without binding with modelAttribute), @RequestParam(“userName”) String name
To be continued…