17

I have no idea what I could've done to cause this because my time spent programming is stretched out and I've already forgotten what I might've done. But now when I load Eclipse it says:

The errors below were detected when validating the file "web-app_2_5.xsd" via the file "web.xml".  In most cases these errors can be detected by validating "web-app_2_5.xsd" directly.  However it is possible that errors will only occur when web-app_2_5.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 'JDK 6 XML-related APIs'.
The entity name must immediately follow the '&' in the entity reference.

My first few lines of web.xml looks like so.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 id="WebApp_ID" version="2.5">

I've read that it could be an error with the server where the file is being retrieved from, or with caching. I've disabled and cleared the cache and as far as I can tell the server is the same everyone else is using unless they switched to an oracle.com url and I haven't found it yet.

Any thoughts would be greatly appreciated.

tenmiles
  • 2,521
  • 3
  • 18
  • 20
  • @Kev: Perhaps I'm missing something, but what does this question have to do with geography? – Michael Scheper Mar 13 '14 at 22:48
  • @MichaelScheper - read the full close reason and the accepted answer - "a specific moment in time". This was a problem specific to a very short moment in time when Oracle broke something temporarily with the servers that host various XML schemas that Eclipse relies on. – Kev Mar 14 '14 at 01:17
  • @Kev: Fair enough. I had the same issue yesterday, however, and I found this post helpful. It suggested network connectivity issue, which turned out to be correct, despite the error implying a formatting issue. – Michael Scheper Mar 14 '14 at 23:45
  • @Kev The Q&A here helped me today. – par Jul 17 '14 at 22:22
  • This question and one of the answers just solved my problem. –  Dec 31 '14 at 14:33
  • 1
    The problem's still occurring with other former Sun Microsystems schema urls, e.g. http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd – Matt Moran Mar 24 '15 at 10:47
  • We should all vote for **"reopen"** since this problem still occurs for http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd namespace locations! – Lonzak Jun 13 '17 at 13:01

4 Answers4

23

Andrew, I'm afraid that your namespace is not correct. I think that version 2.5 should be under javaee namespace (JDK, Java 1.5 and 1.6), not j2ee (J2SDK, Java 1.4).

So replace

http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd

with

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
dmatej
  • 1,518
  • 15
  • 24
  • 1
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd is dead??? what is next domain??? – gpa Jan 29 '16 at 21:58
3

See http://www.reddit.com/r/programming/comments/f9sxu . The problem is Oracle, again. I cannot deploy on SGES 2.1.1 with the connection to the internet. When I turned it off, deploy was slow, but successful. It seems the validator tries to refresh cached schemas and to download them from the schemaLocation URLs.

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
GET /xml/ns/javaee/web-app_2_5.xsd ... 
HTTP/1.1 301 Moved Permanently to Location: 
  http://download.oracle.com/javase/6/docs/technotes/guides/xml/index.html

But there is no such schema!

I will try to find some good solution, but the best is maybe to punch up someone in Oracle ...

EDIT: It is fixed at this time (27.1.2010, 20:00 CET), Oracle returns the schema - you can check it with wget. Browsers are redirected to docs. Nice :-)

dmatej
  • 1,518
  • 15
  • 24
  • Oracle seems to have removed the file again (ten years later). Try using this one: http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_2_5.xsd – Dan R. Feb 05 '21 at 16:21
1

Please take a look at your web.xml

Are there any ´&´-signs, which are not followed by an known XML-Entity? &uuml; are HTML-Entities, not XML-Entites.

lavinio
  • 23,931
  • 5
  • 55
  • 71
Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
1

or write own entity resolver that will lookup those entities locally

in case, for example, hibernate, it is enough to point schema location in proper way: excerpt of hibernate's DTDEntityResolver

private static final String USER_NAMESPACE = "classpath://";
 ...
public InputSource resolveEntity(String publicId, String systemId) {
 ...
else if ( systemId.startsWith( USER_NAMESPACE ) ) {
...

in case of eclipse, you can point to local xsd in: Preferences-->XML-->XML Catalog.

Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
kuzo
  • 76
  • 4