Problem :
I have the following error :
The content of element type "filter" must match "(icon?,filter-name,display-name?,description?,filter-class,init-param*)".
Here is an extract of my web.xml :
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
Solution :
In fact, the solution is in the message.The message said that there is an order in the tags filter-mappings.
You have to put first filter-name then url-pattern or servlet name.
So you have to correct like that :
<filter>
<filter-name>richfaces</filter-name>
<display-name>RichFaces Filter</display-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
An important note, this error appear because I put the following dtd in 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>
Or it's not the last dtd.Now it has change and it seems that the good manner is the following :
<?xml version="1.0"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
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">
Showing posts with label j2ee. Show all posts
Showing posts with label j2ee. Show all posts
Wednesday, August 24, 2011
Sunday, July 24, 2011
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'
Problem :
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"http://java.sun.com/xml/ns/javaee":servlet-class, "http://java.sun.com/xml/ns/javaee":jsp-file}' is
expected.
In Eclipse, I have the following target (display-name) in red :
web.xml :
<servlet>
<servlet-name>monitor</servlet-name>
<display-name>monitor</display-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/monitor-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Solution:
You have to put the tag display-name first.
<servlet>
<display-name>monitor</display-name>
<servlet-name>monitor</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/monitor-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Note : In my google project http://code.google.com/p/lin-mon-webapp/, I have committed a web.xml with no validation error (I just make right click to be sure not having validation error)
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"http://java.sun.com/xml/ns/javaee":servlet-class, "http://java.sun.com/xml/ns/javaee":jsp-file}' is
expected.
In Eclipse, I have the following target (display-name) in red :
web.xml :
<servlet>
<servlet-name>monitor</servlet-name>
<display-name>monitor</display-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/monitor-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Solution:
You have to put the tag display-name first.
<servlet>
<display-name>monitor</display-name>
<servlet-name>monitor</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/monitor-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Note : In my google project http://code.google.com/p/lin-mon-webapp/, I have committed a web.xml with no validation error (I just make right click to be sure not having validation error)
Subscribe to:
Posts (Atom)