Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The content of element type "..." must match in web.xml

I have a problem with my web.xml file. The error:

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*)".

However, my web.xml file is in the order what error say.

Here 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>     <display-name>Archetype Created Web Application</display-name>      <context-param>         <param-name>javax.faces.STATE_SAVING_METHOD</param-name>         <param-value>client</param-value>         <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>     </context-param>            <context-param>         <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>         <param-value>resources.application</param-value>         <description></description>     </context-param>      <servlet>         <servlet-name>Faces Servlet</servlet-name>         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>            <servlet-mapping>         <servlet-name>Faces Servlet</servlet-name>         <url-pattern>/faces/*</url-pattern>     </servlet-mapping>      <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>  </web-app> 

I use WebLogic 10.3.4. Any idea about the problem?

like image 705
erencan Avatar asked Sep 18 '12 07:09

erencan


People also ask

What are the contents of Web xml?

Servlets and URL paths web. xml defines mappings between URL paths and the servlets that handle requests with those paths. The web server uses this configuration to identify the servlet to handle a given request and call the class method that corresponds to the request method.

Which of the following is root element in Web xml?

The root element of a web. xml is web-app .

What is Web xml file in eclipse?

xml file is only used when deploying a Java app to a runtime that includes the Eclipse Jetty 9/ servlet 3 server. For more details, see the Eclipse Jetty 9.3 Runtime. Java web applications use a deployment descriptor file to determine how URLs map to servlets, which URLs require authentication, and other information.


1 Answers

One very simple solution which solves my problem.

Change the schema reference from

<!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></web-app> 

to this

<?xml version="1.0" encoding="UTF-8"?>  <web-app xmlns="http://java.sun.com/xml/ns/javaee"           version="2.5"           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">           // ...          // your all content goes here  </web-app> 
like image 79
Usman Tahir Avatar answered Sep 29 '22 10:09

Usman Tahir