简体   繁体   English

2.1 版的 faces-config.xml xsd 错误

[英]faces-config.xml xsd error for version 2.1

Eclipse keeps telling me there is a problem with http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd on my faces-config.xml, is anyone else having an issue with it? Eclipse 一直告诉我我的faces-config.xml 上的http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd有问题,还有其他人有问题吗?

 <?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:.....开头的错误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

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'. 希望这对'bug'有所帮助和抱歉。

Update: This issue has been resolved. 更新:此问题已得到解决。

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所指出的,在http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd上Oracle缺少2.1 faces-config XSD存在问题

Yet, 2.0 XSD is ok at http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd 然而, http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd可以使用 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地址。

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... 我打赌网址有误,但我脑子里没有正确的...

UPDATE: For 2.0 it is http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd (and the browse returns the .xsd); 更新:对于2.0,它是http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd (并且浏览返回.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? 我发现您在网络中的任何位置发布的URL但不在oracle中发布...您确定在类路径中有2.1库吗?

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

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 . 为了解决这个问题,我只创建一个新的“动态项目”,在项目Facets(项目/属性/项目构面)中,我标记了选项“JavaServer Faces” 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. 之后,您将看到以下消息:“需要进一步配置...”(下方)单击此消息并选择包含javax.faces-2.1.x.jar的库。 Click in "OK" and "Apply". 单击“确定”和“应用”。 The eclipse create the faces-config.xml file that contains the correct description. 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>

If you are using Eclipse , and try to build a dynamic web application .如果您正在使用Eclipse ,并尝试构建一个动态的 web 应用程序 Then meets the error "There is '1' error in ' javaee_7(or other version number).xsd '."然后遇到错误“' javaee_7(或其他版本号).xsd '中存在'1'错误。”

Here is the reason: Eclipse has a strict requirement on the order of attributes .原因如下:Eclipse对属性顺序严格的要求

Here is the solution: Move the last line in the faces-config, which is ' version="2.2" ' or ' version="2.3" ' to the first line right next to faces-config.这是解决方案:将faces-config 中的最后一行,即' version="2.2" ' 或' version="2.3" ' 移到faces-config 旁边的第一行

Like following (I am using JSF version 2.3):如下所示(我使用的是 JSF 2.3 版):

<faces-config version="2.3"
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-facesconfig_2_3.xsd">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM