मैंने MySQL का उपयोग करके एक सरल टू डू लिस्ट ऐप के साथ जावा सर्वलेट सीखने की कोशिश की है, लेकिन मुझे एक समस्या है जब मैंने ToDoListServlet को HTTP स्टेटस 500 प्राप्त करने वाले रूट url में मैप करने का प्रयास किया। यहाँ मेरा है ToDoListServlet कोड:

package com.example7.logic;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.example7.model.DB;

/**
 * Servlet implementation class ToDoListServlet
 */
@WebServlet("/")
public class ToDoListServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ToDoListServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            DB db = new DB();
            List<List<String>> tasks = db.getTasks();
            db.closeConnection();
            request.setAttribute("tasks", tasks);
            request.getRequestDispatcher("index.jsp").forward(request, response);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String task = request.getParameter("task");
        if (task != null) {
            try {
                DB db = new DB();
                db.insertTask(task);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }       
        doGet(request, response);
    }
}

यहाँ web.xml फ़ाइल है:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>ejercicio7</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file> 
    </welcome-file-list>
    <servlet>
        <servlet-name>ToDoList</servlet-name>
        <servlet-class>com.example7.logic.ToDoListServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ToDoList</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

और index.jsp फ़ाइल:

<%@ page import ="java.util.*" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>To Do List</title>
</head>
<body>
    <h1>TODO list</h1>
    <form method="post" action="todolist">
        <input type="text" name="task" placeholder="New task" />
        <input type="submit" value="Add" />
    </form>
    
        <%
            List tasks =(List) request.getAttribute("tasks");
            Iterator it = tasks.iterator();
            out.println("<br>");
            while(it.hasNext()){
                List task = (List) it.next();
                Iterator itTask = task.iterator();
                out.println("<form method='post' action='deleteTask'>");
                out.println("<input type='hidden' name='id-task' value=" + itTask.next() + "/>");
                out.println("<input type='submit' value='delete'/>");
                out.println("</form>");
                out.println(" "+itTask.next()+"<br>");
            }
        %>
    
    <br>
</body>
</html>

और यहाँ त्रुटि है:

javax.servlet.ServletException: La ejecución del Servlet lanzó una excepción
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.ejercicio7.logic.ToDoListServlet.doGet(ToDoListServlet.java:39)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

इसके अलावा, एक Stackoverflowerror दिखाएं।

मैं इसे कैसे ठीक कर सकता हूं?

1
Dogo-San 5 जुलाई 2020, 01:34

1 उत्तर

सबसे बढ़िया उत्तर

समस्या का मूल कारण web.xml में निम्न कॉन्फ़िगरेशन है:

<servlet>
    <servlet-name>ToDoList</servlet-name>
    <servlet-class>com.example7.logic.ToDoListServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ToDoList</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

इस कॉन्फ़िगरेशन के कारण, नियंत्रण एक पुनरावर्ती कॉल में चला जाता है। समस्या का समाधान करने के लिए, बस इन पंक्तियों को अपने web.xml से हटा दें।

सर्वलेट में आपके पास पहले से कॉन्फ़िगरेशन है, @WebServlet("/") और इसके लिए आपको web.xml में अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता नहीं है।

0
Arvind Kumar Avinash 5 जुलाई 2020, 20:06