settingsLogin | Registersettings
Show Menu

.war file deployed in tomcat server but getting Error 404 that is resource not available

0 votes

I have deployed my .war file of a spring mvc project in tomcat server but I'm getting an error 404 saying that the resource is not available All the other example applications on tomcat server is running except for mine. I have seen the other similar questions here and I've followed everyone of them and still getting error.

I have mapped the project as /advocatoree/dashboard

How do I solve this?

asked Jan 10, 2015 by Ashzabin Wadud
It is difficult to say without looking at your codes. You need to put your project up somewhere and send links for us to check.
My problem has been slightly redefined, in the sense that tomcat, by default, adds the name of the .war file to the URL mapping. For example, as I have mentioned earlier, my defined URL mapping is /advocatoree/dashboard but what tomcat does instead, is, it changes it to /Advocatoree/advocatoree/dashboard where Advocatoree is the name of my .war file. Is there any way that I can get rid of the first 'Advocatoree' in the URL? I have to, otherwise, change all the URL mappings and tags in my project, manually.
In your tomcat's conf/server.xml add:

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

in your server.xml file before </Host> ending tag

This will ensure your context being loaded without the war file name in the root. Alternative is rename your war file to ROOT.war and delete the ROOT folder in webapps, and deploy your own ROOT.war file.
Thank you for your answer. I'm using tomcat 8 and it already had a file called context.xml in tomcat's conf. I added the line you mentioned in that file and it worked. Thank you so much once again.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to LivingOnCodes QA, where you can ask questions and receive answers from other members of the community.

Most popular tags

...