I faced this error in Eclipse:
Referenced file contains errors (http://java.sun.com/xml/ns/javaee/web-app.xsd). For more information, right click on the message in the Problems View and select "Show Details..."
Can anyone help me? What is problem? Thanks in advance. My code is:
<?xml version="1.0" encoding="UTF-8"?>
<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.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/dispatcherServlet/servlet-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Try using this URL for the schema definition:
http://oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd
As mentioned above by @Renardo, the following URL...
http://java.sun.com/xml/ns/javaee;http://java.sun.com/xml/ns/javaee/web-app.xsd
...redirects to an HTML page that causes an error within Eclipse.
I had the same problem although my schemaLocation points to web-app_3_0.xml. With 2_4 the problem did not appear. Now I have found that, used as an http address,
java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
is redirected to
www.oracle.com/webfolder/technetwork/jsc/xml/ns/j2ee/web-app_2_4.xsd
which is a valid XSD file. However, the same URL with "3_0" instead of "2_4" is redirected to …/technetwork/java/index.html, which is an HTML file and contains exactly the texts Eclipse complains of.
I am at a loss as to whether
My Eclipse errors went away when I changed the namespace from "…/xml/ns/j2ee" to "…/xml/ns/javaee" and used a URL from Oracle's website that points to a correct XSD. Sorry I cannot post the URL, my low reputation does not allow it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With