I am running a basic servlet code using annotations.. My servlet code is as follows:
package servlettest;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Servlet implementation class HelloServlet
 */
@WebServlet(name = "HS", urlPatterns = {"/t2"})
public class HelloServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    /**
     * Default constructor. 
     */
    public HelloServlet() {
        // TODO Auto-generated constructor stub
    }
    /**
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
//      response.getWriter().append("Served at: ").append(request.getContextPath());
            
        response.setContentType("text/html");
        
        PrintWriter out = response.getWriter();
        
        out.print("<html> <body>");
        out.print("<h3>Hello World</h3>");
        out.print(" </body></html>");
        
        out.close();
        
        
    }
}
But when I run the code on server, I get the error
HTTP Status 404 – Not Found
I am using Tomcat v9.0 server
Since web.xml file is not needed while using annotations, i have deleted it from ServletEx/WebContent/WEB-INF folder
Below is the error I am getting in the browser while accessing the url  http://localhost:8080/ServletEx/t2 and
ServletEx is the project name.
HTTP Status 404 – Not Found
Type Status Report
Message The requested resource [/ServletEx/t2] is not available
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
