if you are using sts and your server is pivotal just double click on the server and go to >modules tab >display configure the web modules on this server.>you can just remove modules and run once again.


 //trying to do more than one thing to the object in the same context, 
//the solution is to work on single context objects

public class singletoncontext<tcontext>
    where tcontext: dbcontext,new()
    private static tcontext _context;

    private singletoncontext()

    public static tcontext getinstance()
        if (_context == null)
            _context = new tcontext();
        return _context;



remove the space or empty line in server.xml or context.xml at the beginning of your code


in my case i found duplicate paths in servers/tomcat5.5 at localhost-config/server.xml under tag. removing the duplicates solved the problem.


delete org.eclipse.wst.server.core and org.eclipse.wst.server.ui from .metadata/.plugins of wrokspace

delete the server from eclipse then reconfig the server in eclipse.


go to servers click right at tomcat click at add and remove then click at remove all


it is pretty easy to do for me. if you created the server and you know the path of the directory where the server files are located then one can simply open the server.xml file which is right inside the server's folder.

just edit the file to remove repeated <context...> tag for the specific project which on running threw the error previously.


  • in eclipse, in servers, expand apache tomcat
  • delete all the "contexts"


i had that problem before. i just solved it by expanding the tomcat tree and delete the folder that is causing the clash. in your case is /firstapache. after you delete it. then you rerun it, you should be able to run. if it happens again, delete it and try again.


this error occurs when you copy a project than past it, and then you change the name of that project.

in such a case, follow the following steps.

step-1: you need to edit your web.xml file. remove servlet and servlet-mapping of the previous projects.

step-2: got to server--> server.xml--> find context

example :- context docbase="jspandservletdemo" path="/jspandservletdemo" reloadable="true" source="org.eclipse.jst.jee.server:jspandservletdemo"/>

now you just need to change the pathname to your current project name.

good luck happy coding :)


try to delete the existing tomcat server in the server console. if you don't have the console then you can go to "show view ->server", delete the server by right clicking on it, then add a new server.


if you are using tomcat 7 and eclipse, click on the tomcat server and then goto the modules tab. there you will find the duplicate entry. remove both the entry and redeploy the application. you are good to go now.


on a related note, if you have copied a project or in anycase, have the same context path for 2 'active' projects, you have to change the context path of one of them, then clean the tomcat server settings, then republish the servers

see this in-more detailed answer


simply remove the server in eclipse and add tomcat server again. than shutdown the tomcat in tomcat/bin/shutdown.bat file and start the server in eclipse.


  1. in your project's properties, choose "web project settings".
  2. change "context root".
  3. clean your server
  4. now you can restart your server


eclipse >> project explorer >> servers >> server.xml >> tag >> remove duplicate tag of your project


in eclipse using tomcat you just open this server.xml file and find context tag and here you see your context name is more then one you just delete useless contexts and restart your server it will working....

enter image description here


go to the servers project in eclipse, under your runtime server configuration(in my case tomcat v7.0 server at localhost-config) go to server.xml file then search for <context> tag, normally you will find more than one context tag, delete them and run your application in the appropriate server that will work now.

in my case i have found duplicate context tag :

<context docbase="my-project" path="/my-project" reloadable="true" source="org.eclipse.jst.jee.server:my-project"/&gt;&lt;context docbase="my-project" path="/smartphone-selfcare" reloadable="true" source="org.eclipse.jst.jee.server:my-project"/></host>


go to server.xml and search for "context" tag with a property name "docbase".

remove the duplicate lines here. then try to restart the server.


in your eclipse ide on project explorer acess the server.xml like in:

enter image description here

and remove context tags with duplicates references for your project:

enter image description here


in eclipse, go to the servers project. open the tree for the tomcat version you are using. open file server.xml and verify your context tags.


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"

you might find duplicates of the same definition that you would need to remove.


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.

Related Query

More Query from same tag