也许您的web.xml包含拼写错误? omn​​ifaces 1.8.1

时间:2015-05-08 00:18:52

标签: jsf-2 web.xml omnifaces

我正在使用Omnifaces 1.8.1,我在启动Tomcat 7时出现此错误

  

WebXml无法初始化。也许您的web.xml包含拼写错误?   java.lang.ClassNotFoundException:at java.lang.Class.forName0(Native   方法)at java.lang.Class.forName(Unknown Source)at   org.omnifaces.config.WebXml.parseErrorPageLocations(WebXml.java:434)     在org.omnifaces.config.WebXml.init(WebXml.java:147)at   org.omnifaces.facesviews.FacesViewsInitializerListener.contextInitialized(FacesViewsInitializerListener.java:63)     在   org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)     在   org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)     在   org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     在   org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1575)     在   org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1565)     在java.util.concurrent.FutureTask.run(未知来源)at   java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)at   java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知来源)at   java.lang.Thread.run(未知来源)

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>

2 个答案:

答案 0 :(得分:1)

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

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

stacktrace中的上一行显示您已配置了classspath中不存在的异常类。

请将您的<error-page/>标记代码段发布到web.xml

答案 1 :(得分:0)

ClassNotFoundException意味着你的xml包含一个在CLASSPATH中找不到的类:要么是拼写错误 - 要么缺少类,因为某些jar丢失或位置错误

org.omnifaces.filter.CharacterEncodingFilter?