0

I just create a new Servlet and I have an error of this exact type: The content of element type "servlet" is incomplete, it must match "(icon?,servlet-name,display-name?,description?,(servlet-class|jsp-file),init- param*,load-on-startup?,run-as?,security-role-ref*)".

my web.xml code:

<!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>Prueba</servlet-name>
    <display-name>Prueba</display-name>
    <description></description>
    <servlet-class>Servlets.Prueba</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Prueba</servlet-name>
    <url-pattern>/Prueba</url-pattern>
  </servlet-mapping>
</web-app>

markos
  • 1
  • You are being told your XML file does not conform to the specification. From a quick visual inspection it looks fine. Are you sure it is not an older version actually being deployed? – Thorbjørn Ravn Andersen May 21 '22 at 05:01
  • I'm sure, actually I just created the servlet, and the xml code was created by default with the servlet – markos May 21 '22 at 05:15
  • I really don't know what happen, but I replace the web.xml for the respective annotation in the servlet and it worked, but I still don´t know what really happen in the web.xml – markos May 21 '22 at 05:28
  • Just a guess: Servlets.Prueba seems not a good class name. Package names should in general be lower case. But I cannot believe this should cause an issue. – Queeg May 21 '22 at 06:37

0 Answers0