服务器启动时出现以下错误。我正在尝试学习RichFaces,下面是我的系统配置。
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener
javax.faces.FacesException: Can't parse configuration file: jar:file:/D:/apache-tomcat-7.0.54/lib/richfaces-components-ui-4.3.7.Final.jar!/META-INF/faces-config.xml: Error at line 2 column 325: cvc-elt.1: Cannot find the declaration of element 'faces-config'.
at com.sun.faces.config.ConfigureListener.parse(ConfigureListener.java:1751)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:496)
at com.sun.faces.config.GlassFishConfigureListener.contextInitialized(GlassFishConfigureListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4971)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Tomcat - apache-tomcat-7.0.54
RichFaces - 4.3.7
tomcat lib中的jar -
annotations-api.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
catalina.jar
commons-fileupload-1.2.2.jar
ecj-P20140317-1600.jar
el-api.jar
guava-r08.jar
jasper-el.jar
jasper.jar
jsf-api-2.0.jar
jsf-impl-1.2.jar
jsp-api.jar
jstl-1.2.jar
org.apache.commons.io.jar
richfaces-components-api-4.3.7.Final.jar
richfaces-components-ui-4.3.7.Final.jar
richfaces-core-api-4.3.7.Final.jar
richfaces-core-impl-4.3.7.Final.jar
servlet-api.jar
tomcat-api.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
tomcat-jdbc.jar
tomcat-util.jar
tomcat7-websocket.jar
websocket-api.jar
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 http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
</faces-config>
Web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>JSF Webapp</display-name>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
请让我知道我做错了什么。
答案 0 :(得分:0)
不确定,你是如何摆脱这个问题的。我也遇到了同样的问题。我删除了以下条目并且它有效。
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
由于您使用的是JSF 1.2及更高版本且Tomcat高于v7.0.42,因此不需要上述条目。