![](/img/trans.png)
[英](xml) cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'
[英]cvc-complex-type.2.4.a invalid content was found starting with element factory in faces-config.xml
我有這樣的錯誤在Eclipse項目中,從進口Netbeans
項目,設置為maven
和項目方面,以Dynamic Web Project
(CDI1.1,爪哇1.8,JS 1.0,JSF 2.2,JAX-RS 2.0,JBoss的Maven的整合和1.0 JPA 2.1)
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
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_2.xsd">
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>fr</supported-locale>
</locale-config>
<resource-bundle>
<base-name>Messages</base-name>
<var>messages</var>
</resource-bundle>
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
</application>
</faces-config>
答案是在問題中,根據XSD
文件http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd ,節點application
下不允許有節點factory
,因此XML
文件無效。
application
下受支持的元素的列表是:
根據XSD
文件,節點factory
似乎與application
處於同一級別,因此直接在faces-config
下,如下所示:
<faces-config ...
<application>
...
</application>
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.