How to set up tomcat context path for web application? .war file name is coming infront of the application name in the url.

February 1, 2015 12.4k views

I am having a trouble getting my web application 'xyz' running at:


The name of my .war file is ".MyWebApp".

after deploying the .war file in tomcat, the application starts at:


any idea how to remove this "MyWebApp" part from the URL?

I have seen some of the solutions for this problem, they are mostly solutions of running the application in localhost. They suggested to change the 'context.xml' file which I already did like this:

<?xml version='1.0' encoding='utf-8'?>

    <!-- Default set of monitored resources -->

     path="" docBase="MyWebApp" debug="0" reloadable="true"

Any help would be very much appreciated!

Thank you in advance!

1 Answer

Without knowing more information about the structure of your application, it's difficult to provide a thorough answer to your question. On Ubuntu 14.04 with a standard Tomcat 7 installation, placing a war file in the CATALINA_BASE directory should accomplish what you want. For instance, let's use the Tomcat "hello world" war:

  • cd /var/lib/tomcat7/webapps
  • wget

Now browsing to http://your.ip.addr:8080/sample will display the application. If you want to remove the app name from the path completely, you can rename the war file to ROOT.war

by Mitchell Anicas
Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of Tomcat 7.0.x on Ubuntu 14.04.
Have another answer? Share your knowledge.