請看下面這段配置就是錯誤的:
<Host name="www.***.com" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
<Context path="" docBase="/tomcat/webapps/***" debug="1" />
<Context path="/***2" docBase="/tomcat/webapps/***2" debug="1" />
</Host>
正確的配置如下
<Host name="www.***.com" debug="0" appBase="" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
<Context path="" docBase="/tomcat/webapps/***" debug="1" />
<Context path="/***2" docBase="/tomcat/webapps/***2" debug="1" />
</Host>
這兩段的區別是第二段去除了appBase="webapps"中的webapps變成了appBase="",因為web應用程序都是放在 webapps這個目錄下的,如果不把“webapps“去掉,這里會調用一次quartz的任務調度,在接下來的“<Context path”中又會調用一次quartz的任務調度,所以就重復了2次