Very often, we need to copy projects for testing purposes in Eclipse.
Sometimes, we face the following issue, immediately after copying from a pervious project.
Could not publish server configuration for Tomcat v8.0 Server at localhost.
Multiple Contexts have a path of “/[contextname]”.
How to solve the error 'Server Tomcat v8 5 Server at localhost failed to start'. This video will help you to understand the root cause of the tomcat error an.
This happens when your tomcat has registered your new application into server.xml, but since you copied the same project, so the context has also duplicated, but this is not allowed. So, you need to follow the below steps to solve the issue.
The Apache Tomcat software is developed in an open and participatory environment and released under the Apache License version 2. The Apache Tomcat project is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. Controls whether paths used in calls to obtain a request dispatcher ares expected to be encoded. This affects both how Tomcat handles calls to obtain a request dispatcher as well as how Tomcat generates paths used to obtain request dispatchers internally. If not specified, the default value of true is used. When encoding/decoding paths for a request dispatcher, UTF-8 is always used.
Tomcat V8.0 Download
First of all, right click on your new project(which you recently copied from an existing project).
In the highlighted space, you will see the context with which you used to run your old project with. Remove that and put the new context that you wish to run your new project with. Example: mynewproject.
So, your project when run, will have the following URL from now on:
The last step is now clean up of your Tomcat server.xml and rebuilding it. The steps to it are simple:
Go to server tab, select the instance of your tomcat that you run your project with and right click on it, it will show you the following options:
Apache Tomcat V8.5 Download
Click on ‘Clean…’ option. It will ask for a confirmation. Click on OK.
Once you do it, it will republish all the projects(along with their contexts) to the instance of the Tomcat server.
Tomcat V8 Download
And that’s all, you should be set to run your new application now.
Hope it helped. Comment on the post if you have any doubts/issues.