amp@java

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            99 隨筆 :: 0 文章 :: 228 評論 :: 0 Trackbacks
          更新了某個webapp,把新的WAR包放到webapps目錄下,Tomcat就會自動把原來的同名webapp刪除,并把WAR包解壓,運行新的webapp。但是,有時候Tomcat并不能把舊的webapp完全刪除,通常會留下WEB-INF/lib下的某個jar包,必須關閉Tomcat才能刪除,這就導致自動部署失敗。
          解決方法是在<Context>元素中增加一個屬性antiResourceLocking="true",默認是"false"。但是這樣會帶來一個問題,Tomcat在運行對應的webapp時,會把下面的文件復制到一個臨時目錄里,所以如果你在服務器運行的時候修改了某個JSP,Tomcat并不會發現,看到的還是修改前的那個頁面。

          以下內容來自Tomcat文檔:Context標簽的位置

          Context elements may be explicitly defined:

          • in the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps
          • in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host
          • in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml.
          • if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files
          • inside a Host element in the main conf/server.xml


          參考資料:
          Tomcat 5.5 文檔:http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
          關于antiResourceLocking的bug:http://issues.apache.org/bugzilla/show_bug.cgi?id=37668
          posted on 2007-06-27 09:35 amp@java 閱讀(1468) 評論(1)  編輯  收藏 所屬分類: WEB

          評論

          # re: Tomcat的資源鎖定 2007-06-27 10:44 fffyt
          既然都用war包部署了,為什么還要直接修改JSP呢.  回復  更多評論
            

          主站蜘蛛池模板: 宝坻区| 藁城市| 忻州市| 临洮县| 伊吾县| 新泰市| 乌兰县| 黑山县| 平遥县| 彰化市| 桂阳县| 汤阴县| 乌兰县| 太康县| 诸暨市| 楚雄市| 南陵县| 台南县| 新化县| 竹北市| 连云港市| 泽库县| 鹤壁市| 凯里市| 改则县| 临猗县| 宜兴市| 方城县| 炉霍县| 腾冲县| 柳州市| 灵山县| 蓝山县| 东平县| 沭阳县| 合阳县| 广东省| 淮南市| 教育| 东平县| 平乡县|