Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 714

Attribute must be declared and The content of element type must match

$
0
0

I have been trying to figure out how to start my weblogic server with my servlet project with maven for three days, but I find that it is giving me errors with the web.xml. I have a colleague who doesn't have this problem in his IDE, but it does for me and I can't find the solution.

This is my 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 xmlns="http://xmlns.jcp.org/xml/ns/javaee"            id="WebApp_ID"           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"           xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee           http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"><display-name>consultCupon202006</display-name><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><servlet><description></description><display-name>Promotion</display-name><servlet-name>Promotion</servlet-name><servlet-class>com.test.consultcupon202006.servlet.Promotion</servlet-class></servlet><servlet-mapping><servlet-name>Promotion</servlet-name><url-pattern>/Promotion</url-pattern></servlet-mapping></web-app>

Mainly the errors it shows me are due to the attributes and the web-app, but even when changing the version or order I still get the same errors:

Multiple annotations found at this line:

  • Attribute "xmlns:xsi" must be declared for element type "web-app".
  • Attribute "xsi:schemaLocation" must be declared for element type "web-app".
  • Content is not allowed in prolog.
  • Attribute "xmlns" must be declared for element type "web-app".
  • The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-

mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-

ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".

  • Attribute "version" must be declared for element type "web-app".

I have edited the web.xml with the changes, but it still gives me another error:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"><display-name>consultCupon202006</display-name><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><servlet><description></description><display-name>Promotion</display-name><servlet-name>Promotion</servlet-name><servlet-class>com.test.consultcupon202006.servlet.Promotion</servlet-class></servlet><servlet-mapping><servlet-name>Promotion</servlet-name><url-pattern>/Promotion</url-pattern></servlet-mapping></web-app>

The markup declarations contained or pointed to by the document typedeclaration must be well-formed.

I have also changed the version of the dependency to:

<dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>provided</scope></dependency>

Any advice or help would help me shed some light on this.


Viewing all articles
Browse latest Browse all 714

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>