eclipse 2.1 版的 faces-config.xml xsd 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12546876/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:02:32  来源:igfitidea点击:

faces-config.xml xsd error for version 2.1

eclipsejsf-2mojarra

提问by casolorz

Eclipse keeps telling me there is a problem with http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsdon my faces-config.xml, is anyone else having an issue with it?

Eclipse 一直告诉我http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd我的 faces-config.xml 有问题,还有其他人有问题吗?

 <?xml version="1.0" encoding="UTF-8"?>

 <faces-config 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-facesconfig_2_1.xsd"
          version="2.1">

 </faces-config>

The error is:

错误是:

  Referenced file contains errors (http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd).  

If I look at the details there are a ton of errors that start with s4s-elt-character:.....

如果我查看详细信息,就会有大量错误开头 s4s-elt-character:.....

I am using mojarra 2.1.13.

我正在使用 mojarra 2.1.13。

Thanks.

谢谢。

EDIT: Apparently Oracle changed it and this fixes it:

编辑:显然甲骨文改变了它,这修复了它:

http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-facesconfig_2_1.xsd

http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-facesconfig_2_1.xsd

采纳答案by John Clingan

We are working on this right now. Identified the issue, working to resolve. Please track this JIRA issue: http://java.net/jira/browse/GLASSFISH-19115

我们现在正在努力解决这个问题。发现问题,努力解决。请跟踪此 JIRA 问题:http: //java.net/jira/browse/GLASSFISH-19115

Hope this helps and sorry for the 'bug'.

希望这对'错误'有所帮助和抱歉。

Update:This issue has been resolved.

更新:此问题已解决。

回答by Jurri

As SJuan76 points out, there's a problem with Oracle missing 2.1 faces-config XSD at http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd

正如 SJuan76 指出的,Oracle 在http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd 上缺少 2.1 faces-config XSD 存在问题

Yet, 2.0 XSD is ok at http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd

然而,2.0 XSD 可以在http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd

The errors are probably due to incorrect response (it's not an XSD at all).

错误可能是由于不正确的响应(它根本不是 XSD)。

Workaround is using the same XSD from a different source (replace the second address in xsi:schemaLocation), for example: https://svn.java.net/svn/mojarra~svn/tags/2.1.13/jsf-api/doc/web-facesconfig_2_1.xsd

解决方法是使用来自不同来源的相同 XSD(替换 xsi:schemaLocation 中的第二个地址),例如:https://svn.java.net/svn/mojarra~svn/tags/2.1.13/jsf-api/ doc/web-facesconfig_2_1.xsd

Warning: This is only a temporary workaround, not nice at all. Someone must first take a look at this at Oracle and put the 2.1 XSD back on java.sun.com address.

警告:这只是一个临时的解决方法,一点都不好。必须先有人在Oracle 上看看这个,然后将2.1 XSD 放回java.sun.com 地址。

回答by user1588834

I have the same Error also,when I create a dynamic web project which has JSF 2.1 Configuration faces-config has this error, so i have to create web project with JSF 2.0 configuration.

我也有同样的错误,当我创建一个具有 JSF 2.1 配置的动态 web 项目时,faces-config 有这个错误,所以我必须用 JSF 2.0 配置创建 web 项目。

回答by SJuan76

Put in your browser the URL:

在浏览器中输入 URL:

 http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd

Oracle is returning a soft 404, and Eclipse (or anybody) can't parse that as xsd.

Oracle 返回软 404,Eclipse(或任何人)无法将其解析为 xsd。

I bet there is a mistake with the URL, but I have not the right one in my head...

我敢打赌 URL 有误,但我脑子里没有正确的那个...

UPDATE: For 2.0 it is http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd(and the browse returns the .xsd); I find the URL you posted anywhere in the web but not in oracle... are you sure you have the 2.1 libraries in your classpath?

更新:对于 2.0,它是http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd(并且浏览返回 .xsd);我找到了你在网络上的任何地方发布的 URL,但在 oracle 中没有......你确定你的类路径中有 2.1 库吗?

回答by Victor Jatobá

I have the same trouble. To solve this I just create a new "Dynamic Project" and in project Facets (project/Properties/Project Facets) I marked the option "JavaServer Faces" version 2.1. After, you will see the message: "Further configuration required..." (below) click in this message and select the lib that contains your javax.faces-2.1.x.jar. Click in "OK" and "Apply". The eclipse create the faces-config.xml file that contains the correct description.

我有同样的麻烦。为了解决这个问题,我只是创建了一个新的“动态项目”,并在项目 Facets (project/Properties/Project Facets) 中标记了选项“JavaServer Faces” version 2.1。之后,您将看到消息:“需要进一步配置...”(下方)单击此消息并选择包含您的 javax.faces-2.1.x.jar 的库。单击“确定”和“应用”。eclipse 创建包含正确描述的 faces-config.xml 文件。

In my project generate this configurations:

在我的项目中生成这样的配置:

<faces-config
    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-facesconfig_2_1.xsd"
    version="2.1">

</faces-config>