consider increasing the maximum size of the cache

项目因加载大量图片和MP4导致Tomcat缓存警告。StackOverflow上的解答指出,可通过增加缓存最大尺寸来解决问题。正确做法是将配置更新添加到context.xml,而非server.xml。示例配置:<Resources cachingAllowed="true" cacheMaxSize="100000" />。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需要耐心啊,太急于求成,希望直接就得到解决方法了...以至于正确方法都已经出现了,我却没有耐心看下去,所以反而又耽误了不少时间....

项目加载100+张图片,还有一个小的MP4,所以console警告缓存不够

org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/base/1325/WA6144-150x112.jpg] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

The background cache eviction process was unable to free [10] percent of the cache for Context [/liuda] - consider increasing the maximum size of the cache. After eviction approximately [11,145] KB of data remained in the cache

反正就是缓存不够了

http://stackoverflow.com/questions/26893297/tomcat-8-throwing-org-apache-catalina-webresources-cache-getresource-unable-to

上面链接是stackoverflow上出现的和我一样的错误,第二个答案成功的解决了这个警告,就是把缓存弄大点。一开始没耐心看答案,直接把代码加进server.xml了,正确的应该是加到context.xml

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <Resources cachingAllowed="true" cacheMaxSize="100000" />  



以上为tomcat报错的解决方案。
但是如果你是用eclipse启动tomcat来运行文件时,每次重启项目时,eclipse的 Servers的context.xml会覆盖tomcat的context.xml文件。所以需要修改eclipse的context.xml。如下图



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值