Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am having a trouble getting my web application 'xyz' running in tomcat 7 server hosted in DigitalOcean servers at:

http://myDomain:8080/myWebApp

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

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

http://myDomain:8080/MyWebApp/myWebApp

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'?>
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

     path="" docBase="MyWebApp" debug="0" reloadable="true"
</Context>

Any help would be very much appreciated!

Do not mark this as duplicate. I have checked all the solutions which worked for me in localhost, but not in digital ocean VPS. I think I am pretty specific here.

Thank you in advance!

like image 598
Tanvir Hossain Khan Avatar asked Sep 28 '22 21:09

Tanvir Hossain Khan


1 Answers

I had to add this line in in the server.xml file. Tod do this:

nano etc/tomcat/server.xml

add this line:

 <Context path="" docBase="Advocatoree" debug="0" reloadable="true"></Context>

Save the file.

Restart tomcat.

like image 157
Tanvir Hossain Khan Avatar answered Oct 06 '22 02:10

Tanvir Hossain Khan