I\'m trying to change the default application of a Tomcat 6 webserver to a different application than \"ROOT\" (inside webapps folder). What is the best way to do this?
Adding a <Context>
tag in the <Host>
tag in server.xml
for Tomcat 6 will resolve the problem.
If you use path=""
empty you can use a URL like http://localhost/first.do
.
In the context tag set attributes docBase="E:\struts-ITRCbook\myStrutsbook"
and reloadable="true"
, then end the context tag.
It should look something like this:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="E:\struts-ITRCbook\myStrutsbook" reloadable="true">
</Context>
</Host>
In Tomcat 7 (under Windows server) I didn't add or edit anything to any configuration file. I just renamed the ROOT folder to something else and renamed my application folder to ROOT and it worked fine.
In Tomcat 7 with these changes, i'm able to access myAPP
at /
and ROOT
at /ROOT
<Context path="" docBase="myAPP"/>
<Context path="ROOT" docBase="ROOT"/>
Add above to the <Host>
section in server.xml
According to the Apache Tomcat docs, you can change the application by creating a ROOT.xml file. See this for more info:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
"The default web application may be defined by using a file called ROOT.xml."
I've got a problem when configured Tomcat' server.xml
and added Context element.
He just doesn't want to use my config:
http://www.oreillynet.com/onjava/blog/2006/12/configuration_antipatterns_tom.html
If you're in a Unix-like
system:
mv $CATALINA_HOME/webapps/ROOT $CATALINA_HOME/webapps/___ROOT
ln -s $CATALINA_HOME/webapps/your_project $CATALINA_HOME/webapps/ROOT
Done.
Works for me.
You can do this in a slightly hack-y way by: