Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Language Servers: There is '1' error in 'javaee_7.xsd'

When I try to auto generate the web.xml file while creating a Dynamic Web Project in the Eclipse Enterprise version it shows an error of type "Language Servers". It indicates to this element of the web.xml file as error:

<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_4_0.xsd"
    version="4.0"
>

the error being

  • There is '1' error in 'javaee_7.xsd'.
  • schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema.).
like image 262
sibasis sahu Avatar asked Apr 26 '21 17:04

sibasis sahu


People also ask

How do I use Web XML?

web. xml defines mappings between URL paths and the servlets that handle requests with those paths. The web server uses this configuration to identify the servlet to handle a given request and call the class method that corresponds to the request method. For example: the doGet() method for HTTP GET requests.

What is XSI schemaLocation?

The xsi:schemaLocation attribute locates schemas for elements and attributes that are in a specified namespace. Its value is a namespace URI followed by a relative or absolute URL where the schema for that namespace can be found. It is most commonly attached to the root element but can appear further down the tree.

How do I open an XSD file in eclipse?

To create it, select New -> Examples... to launch the wizard. Follow the instructions described in the wizard, then click Finish to create the example project. Once created, under the PublicationCatalogue folder, locate the Catalogue. xsd file and double click the file to open it in the XML Schema Editor.


Video Answer


1 Answers

This is a bug in Eclipse which manifested since 2021-03.

It's broken down here: https://github.com/eclipse/lemminx/issues/1042#issuecomment-859778034:

Ok I can reproduce the issue with a fresh Eclipse IDE (the last). I can explain the problem but I don't know how to fix it (for the moment).

When you have "There is '1' error in 'jakartaee_9.xsd'" error, you must open the XSD file (from the cache) and you should see 1 error and 1 warning:

image

There is a warning:

schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.  jakartaee_9.xsd /lemminx-cache/https/jakarta.ee/xml/ns/jakartaee    line 52 Language Servers

image

which try to define xml:lang attribute inside xml.xsd file. But here the xml.xsd cannot be retrieved (the warning message) and you have the error:

image

It tries to download the XSD from platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd but platform is specific to Eclipse IDE. In other words when http://www.w3.org/2001/xml.xsd must be resolved, it says that platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd is the location of XSD. I don't know who do that?

I have the impression than LemMinx is configured to use XML catalog from WTP:

image

While waiting for the Eclipse version with the fix (which is indeed not yet released at the time of writing), one work around is disable the LemMinx validation:

@chris21k please note that you can disable LemMinx validation:

image

like image 155
BalusC Avatar answered Oct 23 '22 13:10

BalusC