Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 593
kkk Avatar asked Oct 06 '22 16:10

kkk


People also ask

Could not publish server configuration for Tomcat multiple contexts have a path of?

Multiple Contexts have a path of “/MyProject”. We can solve this problem either from Eclipse IDE itself or by editing a file outside of Eclipse. – There should be multiple definitions for the path of your project.

What is context path in Tomcat?

A context path in Apache Tomcat refers to the name of the website as presented by the browser. For example, imagine I tell you to enter "localhost:8080/DemoWebsite/DateJSP. jsp" in your browser. The context path is "DemoWebsite". The term "context" in Tomcat is in fact synonymous with "website".


2 Answers

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.

like image 101
Alex Ciminian Avatar answered Oct 21 '22 23:10

Alex Ciminian


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.

like image 77
Daniel Adenew Avatar answered Oct 21 '22 21:10

Daniel Adenew