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 阅读(1452) 评论(1)  编辑  收藏 所属分类: WEB

评论

# re: Tomcat的资源锁定 2007-06-27 10:44 fffyt
既然都用war包部署了,为什么还要直接修改JSP呢.  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: