Tomcat : consider increasing the maximum size of the cache

04-Mar-2019 17:17:13.220 WARNING [http-nio-8080-exec-1] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/jsbundles/config-tabbar.js] to the cache for web application [/jenkins] because there was insufficient free space available after evicting expired cache entries – consider increasing the maximum size of the cache
04-Mar-2019 17:17:13.222 WARNING [http-nio-8080-exec-1] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/jsbundles/config-scrollspy.js] to the cache for web application [/jenkins] because there was insufficient free space available after evicting expired cache entries – consider increasing the maximum size of the cache

톰캣시작시 catalina.out로그에 위와 같은 경고가 발생한다면 설정된 톰캣 캐시 크기를 지정하거나 좀 더 늘려준다. 늘려주는 방법은 TomcatHome/conf/context.xml에 아래와 같이 cacheMaxSize 값으로 지정한다. 이 때 단위는 kb이다.

 <?xml version="1.0" encoding="UTF-8"?>
 <Context>
     <WatchedResource>WEB-INF/web.xml </WatchedResource>
     <WatchedResource>WEB-INF/tomcat-web.xml </WatchedResource>
     <WatchedResource>${catalina.base}/conf/web.xml </WatchedResource>
     <Resources cacheMaxSize="10000" />
 </Context>

이 때 캐시 지정된 캐시 크기가 너무 작다면 아래와 같은 경고 메세지가 발생한다. 경고 메세지가 발생하지 않도록 적당한 캐시 크기를 지정해야 한다.

04-Mar-2019 17:32:28.334 WARNING [main] org.apache.catalina.webresources.Cache.enforceObjectMaxSizeLimit The value of [512]kB for objectMaxSize is larger than the limit of maxSize/20 so has been reduced to [500]kB