'Copying a Java Dynamic Web Project and renaming it to new one causes the error in Tomcat

In eclipse whenever we copying a java dynamic web project into new one by renaming it and trying to run the new copied project in tomcat server it causes below error:

"Could not publish server configuration for Tomcat v9.0 Server at localhost. Multiple Contexts have a path of "/CopiedParentDynamicProjectName".

Anyone have idea how to overcome this tomcat error after copying the dynamicwebproject while running it server.



Solution 1:[1]

Step 1) Open Servers folder and click on server.xml file.

Step 2) Scroll all the way down to find following code

<Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/>
  <Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/>

Step 3) See the duplicate entry and delete one.

Step 4) Change the path so that we have following code.

<Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo-01-base-app" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/><Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/>

Step 5) Save the file.

Step 6) Problem is solved.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ankit