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呢.  回復  更多評論
            

          主站蜘蛛池模板: 称多县| 淳安县| 大港区| 泊头市| 涞源县| 溆浦县| 文水县| 横峰县| 锡林浩特市| 无棣县| 醴陵市| 德江县| 从江县| 隆子县| 新野县| 五河县| 翼城县| 蒙自县| 大新县| 阿巴嘎旗| 浑源县| 巴南区| 枞阳县| 荥经县| 定陶县| 师宗县| 岳西县| 阳信县| 玉树县| 磴口县| 从江县| 玛沁县| 故城县| 公安县| 六枝特区| 广河县| 鹿泉市| 晋州市| 囊谦县| 惠水县| 金乡县|