Eclipse Tomcat 9 警告: Unable to add the resource at [***] to the cache...

最近在Eclipse中使用Tomcat 8 的时候总是出现大量如下的警告:

警告: Unable to add the resource at [/WEB-INF/lib/springwebmvc-3.0.2.RELEASE.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

搜索解决方法大概有三种:
  第一种就像上面警告提示的一样,增大缓存空间,找到Tomcat 的存放目录,$CATALINA_BASE/conf/context.xml,比如我的电脑上Tomcat的目录是 D:\Java\apache-tomcat-8.5.4,该目录下找到conf/context.xml配置文件,在context里面添加如下配置:

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

 第二种方法,就是禁用缓存,disable the cache,在context标签里面添加如下设置:

<Resources cachingAllowed="false"/>

   第三种方法,就是设置Eclipse属性,在目标路径下添加: -Xms128m -Xmx512m

我按照这三种方法修改,却一直不好使,没有办法,就把server 里的Tomcat全都删掉,重新添加,点击 Window->Preference->Server->Runtime Environment,可以看到 Eclipse 里已有的所有Server,全部remove后重新导入,点击Add,选择你要的版本,找到本地目录,选中Tomcat,然后finish 即可。 
我要说的重点是,在 Eclipse中打开 Server视图,双击我们刚才添加的Tomcat,打开它的设置属性的页面。在Server Locations处有三个单选按钮,如果你想要你在 Tomcat 的目录下的设置生效,就必须选择第二项,它表示 Eclipse 直接使用 Tomcat 及它的配置,而不是使用 Eclipse workspace 中的设置。

通过上面的方法,这些警告已经消除了。

猜你喜欢

转载自blog.csdn.net/weixin_39247773/article/details/82853390
今日推荐