今天在Eclipse导入项目时,web-inf出现红叉,百度无果后自行研究。 错误的文件是web.xml
<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" >
错误是:
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.).
有一个外国博客说,这是Eclipse从21年3月开始,就出现了一个错误。
当这个错误发生时,打开它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>. jakartaee_9.xsd /lemminx-cache/https/jakarta.ee/xml/ns/jakartaee line 52 Language Servers 尝试在xml.xsd文件中定义xml:lang属性在这里无法检索,但是sml.xsd,错误,
解决方法: 一、等待有修复程序的人Eclipse版本
二,禁用LemMinx验证: 在windows->preferences 中,选择XML(Wild Web) 点击Validation 将Enable validation取消选择