title: How to set context path in Tomcat so one could enter the site without appending the deployed folder name?
body: <p>I read about this on Tomcat guide <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/context.html#Common_Attributes" rel="noreferrer">here</a> and some SO questions. And I think I'm pretty much doing the same thing. But in some way cannot manage to succeed.</p>
  
  <p>First of all I have to say that my application is deployed on a shared Tomcat server that I have no control over. I just drop my <em>.war</em> file and it gets deployed.</p>
  
  <p>I tried to package my application as <em><strong>ROOT.war</strong></em> but didn't work. The admin told me to package it as whatever the name I want and they would take care of it.
  I packaged it as <em><strong>my-application.war</strong></em> and it got deployed but I have to enter <em><strong><a href="http://my-host/my-application" rel="noreferrer">http://my-host/my-application</a></strong></em> to get to the website.  </p>
  
  <p>After contacting the admin they told me that they have put a context elemnt in my host in Tomcat config file like:</p>
  
  <pre><code>&lt;Context path="" docBase="path of my-application deployed folder"/&gt;
  </code></pre>
  
  <p>which was supposed to set <em><strong>my-application</strong></em> as default application for all the requests coming to <code>my-host</code>. But it didn't and whenever I enter <em><strong><a href="http://my-host" rel="noreferrer">http://my-host</a></strong></em> I get:</p>
  
  <pre><code>HTTP Status 404 - / The requested resource (/) is not available
  </code></pre>
  
  <p>But again when I enter <em><strong><a href="http://my-host/my-application" rel="noreferrer">http://my-host/my-application</a></strong></em> it all works fine. Any suggestion on what might be wrong is definitely appreciated.</p>
  
  <p><strong>Updates:</strong><br>
  I tried to follow the steps described in tomcat documentation on <a href="http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F" rel="noreferrer">how to make the application default</a>. 3 ways are described and I tried all three ways and could successfully deploy my application as ROOT on localhost.  </p>
  
  <p>I also tried to reproduce the problem I'm facing on remote server so I could find the reason and report it to admin. I find couple of problems.</p>
  
  <ol>
  <li>In <em>server.xml</em> fragment that admin sent me <em>autoDeploy</em> and <em>deployOnStartUp</em> are set to true, whereas they should be false if explicitly defining Context element in server.xml. This will cause double deployment which creates a ROOT folder and a folder with the name of the .war file. Deleting the .war will delete it's corresponding folder and undeploys the application but ROOT remains and must be deleted manually and requires a Tomcat restart. Until it's restarted any deployment of ROOT.war will fail.</li>
  <li>I figured there are some reasons preventing ROOT.war from deploying. One could be that a <em><strong>ROOT.xml</strong></em> exists in <em><strong>conf/{engine-name}/{host-name}</strong></em> or a ROOT folder exists in appBase of the host or as I described above a ROOT application from previous deployment is not undeployed and requires Tomcat restart.</li>
  </ol>
  
  <p>Either way I couldn't exactly pinpoint what exactly is preventing ROOT.war from deploying since that requires the access to Tomcat log files and conf files to check the cases I described above.  </p>
  
  <p>Also from all I see my the admin seems incapable of maintaining a Tomcat server and finding the problem. So I decided to go with a dedicated Tomcat server after struggling with the shared one.  </p>