(Sorry for my english, please correct if somethings are wrong).
I have a webapp (spring mvc 4 application) which code is placed in tomcat-7/webapp/mywebapp/
folder. Webapp is accessed via browser with url http://my-web-app.loc:8080
(i.e. without context root name mywebapp
after port number). I have following setups in tomcat-7/conf/server.xml
:
<Host name="my-web-app.loc" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="mywebapp" reloadable="true" allowLinking="true" antiJARLocking="true" copyXML="true" />
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="mywebapp.access."
suffix=".log"
pattern="common"
resolveHosts="true" />
</Host>
I delploy webapp by placing war-file into /webapp
folder. But after war-file is unpacked and webapp is successfully deployed, I can access to webapp only with http://my-web-app.loc:8080/mywebapp
url. Url http://my-web-app.loc:8080
directs me to 404 tomcat error page.
What I have to setup to access to webapp with http://my-web-app.loc:8080
url?
Re-name the directory from mywebapp
to ROOT
(case matters, even on a case-insensitive filesystem).
Also, don't put your <Context>
element in server.xml
. Instead, put it into your web application under META-INF/context.xml
.