Home:ALL Converter>maven servlet HTTP Status 404 -

maven servlet HTTP Status 404 -

Ask Time:2015-07-21T02:23:32         Author:nikolay

Json Formatter

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.

enter image description here 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:

enter image description here

Author:nikolay,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/31523674/maven-servlet-http-status-404
Steve C :

Your application has a structural error.\n\nThe source file Cezar.java should be in src/main/java instead of src/main/resources.\n\nTherefore the file is not being compiled into the Cezar.class file which would be added to your web application's WEB-INF/classes directory.",
2015-07-21T02:18:33
yy