问题:为了配置虚拟路径,增加了<context>之后,再次启动tomcat,显示已经启动,但是查看端口启动“netstat -nltp | grep 端口号” 情况,就不显示有这个端口,把appBase="webapps"中的文件夹,挪到docBase中,情况就好了
原因:应该是路径两次加载出错的问题
原代码:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context path="" docBase="\lottery-master" />
</Host>
原本在文件中appBase="webapps" 中已经有了加载webapps这个文件夹的选项,
<Context path="" docBase="\lottery-master" />是我后来又自己配置的路径这里面也有一个docBase路径,猜测是两个冲突了,因为在我的本地tomcat就是按照原代码配的,并没有出现问题
修改后的文件:
<Host name="localhost" appBase=""
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context path="" docBase="webapps\lottery-master" />
</Host>