在eclipse导出的maven项目war包,放到tomcat下启动,顺利启动且无报错,但是浏览器访问该项目时显示404
原因:未在server.xml中配置这几个项目,导致服务器查找不到
解决方法:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="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" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/> <Context docBase="cas-server-webapp" path="/cas" reloadable="true"/> <Context docBase="portal" path="/portal" reloadable="true"/> <Context docBase="workflow-design" path="/workflow-design" reloadable="true" /> </Host>
server.xml中使用<Context />元素将项目引入。