Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse web.xml Referenced File Error

Tags:

java

eclipse

I imported a project in eclipse as maven project - I upgraded the web-app versions from 2.5 to 3.1 because it got imported as Dynamic web Module 3.1. Now I am getting the following error :

The errors below were detected when validating the file "web-app_3_1.xsd" via the file "web.xml". In most cases these errors can be detected by validating "web-app_3_1.xsd" directly. However it is possible that errors will only occur when web-app_3_1.xsd is validated in the context of web.xml.

s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than xs:appinfo and xs:documentation. Saw 'var _U="undefined";'

Related Questions:

  1. Question1
  2. Question2

Above 2 questions on SO point to the same issue and the answers suggests that the namespace should be javaee, which is already the case:

<web-app version="3.1" 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_1.xsd">
like image 787
ittsmee Avatar asked Sep 12 '15 12:09

ittsmee


1 Answers

Try this in your web.xml, note that xmlns points to http://xmlns.jcp.org

<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">

Try removing the web module entry from org.eclipse.wst.common.project.facet.core.xml save the file, Go to 'Project Facets' and change it to Dynamic Web Module Version 3.1.

Example

like image 127
Tarun Gupta Avatar answered Oct 20 '22 18:10

Tarun Gupta