Tomcat 10.0.4 doesn’t load servlets (@WebServlet classes) with 404 error

I’m having a problem with my first Web Application. I use IntelliJ as IDE and Tomcat as Webserver. Every servlet I’ve tried to acces, throws an 404 Error. Even if I copy some youtube tutorials, which seems to work like a charm.

The button in the form sends me to: http://localhost:8080/IUBHQuiz/login

Can you tell me whats wrong? I am going nuts.

package com.example.IUBHQuiz;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.sql.*;

public class login extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        PrintWriter out = response.getWriter();

        String email = request.getParameter("fmail");
        String pass = request.getParameter("fpw");

        if(email.equals("j") && pass.equals("j"))
            RequestDispatcher rs = request.getRequestDispatcher("/main.jsp");
            rs.forward(request, response);
            out.println("Username or Password incorrect");

            RequestDispatcher rs = request.getRequestDispatcher("/index.jsp");
            rs.include(request, response);



<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
    <title>IUBH Quiz</title>
    <link href="./resources/css/style.css" rel="stylesheet">
    <div class="main">
        <div class="image-container">
           <img src="./resources/images/logo.png" alt="Logo">
        <div class="Login">
            <h1>Willkommen beim IUBH-Quiz!</h1>
            <form action="login" method="post">
                E-Mail:<input type="text" id="fmail" name="fmail"><br><br>
                Passwort: <input type="password" id="fpw" name="fpw"><br><br>
                <input type="submit" value="Log In" class="button">
        <div class="Links">
            <a href="#">Passwort vergessen</a>
            <a href="#">Registrieren</a>


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns=""

Thanks, Janick


I had the same issue while reproducing the problem reported at IntelliJ IDEA forums.

It didn’t work with Tomcat 10 for the reasons described in the answer by Piotr P. Karwasz, but it works just fine with Tomcat 9.0.44 and earlier versions.

Leave a Reply

Your email address will not be published. Required fields are marked *