Eclipse Tomcat 8 警告: Unable to add the resource at

  • 2019 年 10 月 8 日
  • 筆記

Eclipse Tomcat 8 警告: Unable to add the resource at [***] to the cache…

2017年05月04日 21:04:07 學海無涯1993 閱讀數 11443更多

分類專欄: Java web

版權聲明:本文為部落客原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接和本聲明。

本文鏈接:https://blog.csdn.net/ww951993/article/details/71179149

最近在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
  • 1

  在Tomcat 7中一直沒有出現這種警告,參考其他文章,解決方法大概有兩種:   一種就像上面警告提示的一樣,增大快取空間,找到Tomcat 的存放目錄,$CATALINA_BASE/conf/context.xml,比如我的電腦上Tomcat的目錄是 D:Javaapache-tomcat-8.5.4,該目錄下找到conf/context.xml配置文件,在context裡面添加如下配置:

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

  第二種方法,就是禁用快取,disable the cache,在context標籤裡面添加如下設置:

<Resources cachingAllowed="false"/>

我按照這兩種方法修改,在Eclipse里卻一直不好使,沒有辦法,就把server 里的Tomcat全都刪掉,重新添加,點擊 Window->Preference->Server->Runtime Environment,可以看到 Eclipse 里已有的所有Server

  然後重新導入,點擊Add,選擇你要的版本,找到本地目錄,選中Tomcat,然後finish 即可。   我要說的重點是,在 Eclipse中打開 Server視圖,雙擊我們剛才添加的Tomcat,打開它的設置屬性的頁面。

  在Server Locations處有三個單選按鈕,如果你想要你在 Tomcat 的目錄下的設置生效,就必須選擇第二項,它表示 Eclipse 直接使用 Tomcat 及它的配置,而不是使用 Eclipse workspace 中的設置。(好比我之前往 Eclipse 中導入同步於SVN 的工程,一不小心選擇了 Copy Projects to workspace, 結果無論我改動了什麼,SVN工程都沒有變化,原因很簡單,這就是原件和複印件的關係)。   從 Tomcat 7 升級到 Tomcat 8 遇到的問題,可以參考官網文檔:http://tomcat.apache.org/migration-8.html#Web_application_resources   通過上面的方法,這些警告已經消除了。

(adsbygoogle = window.adsbygoogle || []).push({});