Stack Exchange
maven servlet HTTP Status 404 -
Cant run maven servlet whatever i do. If i restart server, ill get next error: 
     HTTP Status 500 - Error instantiating servlet ---

If i restart page without restarting a server - ill get
     HTTP Status 404 - 

There is maven project structure.

web.xml:
     <!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

     <web-app>
       <display-name>Archetype Created Web Application</display-name>
       <servlet>
          <servlet-name>Cezar</servlet-name>
          <display-name>Cezar</display-name>
          <description></description>
          <servlet-class>Cezar</servlet-class>
       </servlet>
       <servlet-mapping>
          <servlet-name>Cezar</servlet-name>
          <url-pattern>/Cezar</url-pattern>
       </servlet-mapping>
     </web-app>

Cezar.java: 
      import java.io.IOException;
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;

      public class Cezar extends HttpServlet {
          public void doGet(HttpServletRequest request, HttpServletResponse                   response)
        throws IOException{
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<body>");
            out.println("<h1>Hello Servlet Get</h1>");
            out.println("</body>");
            out.println("</html>"); 
        }
   }

deployment assembly:


plz share ur Deployment Assembly details.Right Click on ur web project in Project Explorer -> select 'Properties'. Under project properties, select 'Deployment Assembly'.

Your application has a structural error.
The source file Cezar.java should be in src/main/java instead of src/main/resources.
Therefore the file is not being compiled into the Cezar.class file which would be added to your web application's WEB-INF/classes directory.

Yea this was the fix for me. Odd enough that the maven webapp project doesn't come with a java folder so I had to add it myself. Great job, thanks!

yes he is true and better to maintain package structure and give the fully qualified name in web.xml at  Example: your package name.your servlet class name.
