Tomcat Server is failed to run the Eclipse

I am trying to run java applications by using tomcat server version 9 . When I created first project and project was running successfully but the problem is when I created another project and assign this project with the server , I am getting following errors .

Server Tomcat v9.0 Server at localhost failed to start.

Here is code for index.html

<!DOCTYPE html>
<form action="login">
User Name:<input type="text" name="userName"/>
Password:<input type="password" name="userPassword"/>
<input type="submit" value="submit"/>

Here is the Servlet code .

package Edureka;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
public class MyServlet1 extends HttpServlet{
    private static final long serialVersionUID = 1L;

public void doGet(HttpServletRequest request,  HttpServletResponse response) {
PrintWriter pwriter = response.getWriter();
String name = request.getParameter("userName");
String password = request.getParameter("userPassword");
pwriter.print("Hello here:"+name);
pwriter.print(" Your Password is: "+password);
//Creating two cookies
Cookie c1=new Cookie("userName",name);
Cookie c2=new Cookie("userPassword",password);
//Adding the cookies to response header
pwriter.print("<a href='welcomehere'>View Details</a>");
}catch(Exception exp){

Here is the web.xml file .

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="" id="WebApp_ID" version="4.0">


Here is screen shot when I tried to run it in Eclipse..

enter image description here

1 answer

  • answered 2019-09-10 03:02 nitind

    You are using the WebServlet annotation and the url-pattern mapping in the deployment descriptor with the same URI. Only do that in one place.