faces-config.xml xsd error for version 2.1

半世苍凉 提交于 2019-12-08 16:31:44

问题


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?

 <?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:.....

I am using 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


回答1:


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

Hope this helps and sorry for the 'bug'.

Update: This issue has been resolved.




回答2:


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

Yet, 2.0 XSD is ok at 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).

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

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.




回答3:


Put in your browser the 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.

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); 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?




回答4:


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.




回答5:


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.

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>


来源:https://stackoverflow.com/questions/12546876/faces-config-xml-xsd-error-for-version-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!