13

I am running tomcat server 6.0, when I tried to run any web app on this server it gives me a error saying "Two or more Web modules defined in the configuration have the same context root To start this server you will need to remove the duplicate(s)."

I am using Eclipse 3.6 helios.

How do I remove the duplicates?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Jeevan Dongre
  • 4,627
  • 13
  • 67
  • 129

8 Answers8

19

In your tomcat conf directory, edit server.xml. My guess is that in there you have two entries for teh same context. Look for two occurrences of the same line. The line will look like the following, where "someApplication" would be your context root.

<Context docBase="someApplication" path="/someApplication" reloadable="true" source="org.eclipse.jst.jee.server:someApplication"/>
misterblinky
  • 206
  • 3
  • 3
11

I had this problem and I clicked on "Servers" located near the console.Then I Hit the drop down arrow and deleted the module that caused the problem. For me it was the one which had my file name printed twice and on next to one of them (initialized) was written. I got rid of that one and the problem went away.

Brandi S
  • 113
  • 1
  • 5
5

I got this problem before. Just remove your server entity (Apache Tomcat..xxxx) in your server tab and add a new one.

ЯegDwight
  • 24,821
  • 10
  • 45
  • 52
Jerry Chen
  • 426
  • 5
  • 10
1

For some reason Eclipse will sometimes put duplicate context tags in the servers.xml file.

Peter Drinnan
  • 4,344
  • 1
  • 36
  • 29
1

I got "Two or more Web modules defined in the configuration have the same context root" error . I clicked on the server tab, then deleted the tomcat server from it and the server tab remained empty. Then i re-added the new tomcat server again. Thanks for yr support

Umar Kayondo
  • 405
  • 4
  • 9
1

Resolved the issue:

Two or more Web modules defined in the configuration have the same context root (/WebProject). To start this server you will need to remove the duplicate(s).

Either by Removing Frome Server.xml

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>

  <Context docBase="WebProject" path="/WebProject" reloadable="true" source="org.eclipse.jst.jee.server:WebProject"/>
  <Context docBase="WebProject" path="/WebProject" reloadable="true" source="org.eclipse.jst.jee.server:WebProject"/>
</Host>

OR Remove total Web-module from Modules View and Add or Remove the project by right click on server

enter image description here

Yash
  • 9,250
  • 2
  • 69
  • 74
0

Right click on a server, choose: Add and Remove and then using the Remove button remove all projects but the one you want to run

jarosik
  • 4,136
  • 10
  • 36
  • 53
0

Double click on the server tab

Select the Modules tab

You get a list of the context of the server, you have the option to delete or add one or more.

Merzouk MENHOUR
  • 107
  • 1
  • 5