tomcat重复部署项目解决
Posted on: 2018-04-06, Last modified: 2018-04-06, View: 696

以war包形式部署应用到tomcat服务器会遇到重复部署的问题,在官方文档有明确的提示,先看下原文:

If you want to deploy a WAR file or a directory using a context path that is not related to the base file name then one of the following options must be used to prevent double-deployment:

  • Disable autoDeploy and deployOnStartup and define all Contexts in server.xml
  • Locate the WAR and/or directory outside of the Host's appBase and use a context.xml file with a docBase attribute to define it.

意思很明白,就是以war包部署,又想定义不一样的context path,如果不遵守下面两个原则就会引起重复部署,解决方案翻译过来就是:

1、在host标签下设置属性autoDeploy=false和deployOnStartup=false,同时所有context设置在server.xml里
2、war文件放到根目录appBase之外的地方

 

Go
Friend Links:
Bill Site
https://item.taobao.com/item.htm?spm=a21an.7676007.1998473182.296.lAvrE2&id=45399580446