Wednesday, May 21, 2014

Resolved: Change the Project facet Dynamic Web Module and fix web-app_2_5 xsd

Removed
I was using an existing web application. So when I copied the code, I get this error:

Description Resource Path Location Type
Cannot change version of project facet Dynamic Web Module to 2.4. webappVaadin line 1 Maven Java EE Configuration Problem

In fact, in web.xml I have seen that the version of the servlet was 2.4.


1
2
3
<web-app id="WebApp_ID" version="2.4"
 xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


But in the Project facets, it was Servlet 2.5.



By only changing the version from 2.4 to 2.5, I still get error:

Description Resource Path Location Type
Referenced file contains errors (http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd). 

At the end I have find the solution: For Web 2.5, the namespace has changes from j2ee to javaee, So the declaration should be :


1
2
3
4
5
<web-app 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"
       version="2.5">

Using Servlet 3.0, we need to declare it like this :

1
2
3
4
5
<web-app 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_3_0.xsd"
       version="3.0">



2 comments :

Articles les plus consultés