也许您的 web.xml 包含错字?全能面 1.8.1

Perhaps your web.xml contains a typo? omnifaces 1.8.1

我正在使用 Omnifaces 1.8.1,我在启动时遇到了这个错误 Tomcat 7

WebXml failed to initialize. Perhaps your web.xml contains a typo? java.lang.ClassNotFoundException: at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.omnifaces.config.WebXml.parseErrorPageLocations(WebXml.java:434) at org.omnifaces.config.WebXml.init(WebXml.java:147) at org.omnifaces.facesviews.FacesViewsInitializerListener.contextInitialized(FacesViewsInitializerListener.java:63) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) 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)

web.xml :

<context-param>
    <param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
    <param-value>/*.xhtml</param-value>
</context-param>




    <filter>
            <filter-name>characterEncodingFilter</filter-name>
            <filter-class>org.omnifaces.filter.CharacterEncodingFilter</filter-class>
    </filter>
    <filter-mapping>
            <filter-name>characterEncodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
    </filter-mapping>

<!--     <filter> -->
<!--             <filter-name>facesExceptionFilter</filter-name> -->
<!--             <filter-class>org.omnifaces.filter.FacesExceptionFilter</filter-class> -->
<!--     </filter> -->
<!--     <filter-mapping> -->
<!--             <filter-name>facesExceptionFilter</filter-name> -->
<!--             <servlet-name>Faces Servlet</servlet-name> -->
<!--     </filter-mapping> -->

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

ClassNotFoundException 表示您的 xml 包含无法在 CLASSPATH 中找到的 class:要么是打字错误 - 要么 class 丢失,因为某些 jar 丢失或错误地点

org.omnifaces.filter.CharacterEncodingFilter ?

at org.omnifaces.config.WebXml.parseErrorPageLocations(WebXml.java:434)

WebXml 是 omnifaces 中的实用程序 class,它为常用的 web.xml 元素提供方法。

堆栈跟踪中的上述行表明您配置了一个异常 class,它在 classspath 中不存在。

请 post 您在 web.xml

中的 <error-page/> 标签片段