Multiple contexts with the same path error running web service in Eclipse using Tomcat
This is the error that I got when I created my first Axis2 web service using Eclipse. After I wrote the class, I created the web service with Apache Axis2. When I click the start server button in eclipse it gives an error message:
Could not publish server configuration for Tomcat v6.0 Server at localhost.
Multiple contexts have a path of "/FirstApache".
FirstApache is the dynamic web project that I created before. I selected the correct web project from the configuration part in the web service wizard.
How can I fix this?
Solution 1:
Search for the server.xml
file and check your <Context>
tags, probably there are multiple definitions for the same path. Remove the duplicates and it should work for you.
Check out the answer here.
Auto-format the xml file (control + shift + f) since the second <Context>
tag may be on the same line, but outside the viewport and really far away from the visible one.
Solution 2:
In STS/Eclipse go to "project explorer" or "package explorer" and
there is a folder called "server." Open it and you will find server.xml
file. Inside this file at the bottom you find a definition like
<Context docBase="myproject" path="/myproject" reloadable="true"
source="org.eclipse.jst.jee.server:myproject"/>
You might find duplicates of the same definition that you would need to remove.