我在WildFly 8.2上運行Java EE 7應用程序。我使用OmniFaces 1.8.1。 我看到了有關FacesViewsForwardingFilter
日誌文件NullPointerExceptions
:在org.omnifaces.facesviews.FacesViewsForwardingFilter的NullPointerException
2015-02-11 15:42:22,870 ERROR [io.undertow.request] (default task-12) UT005023: Exception handling request to /login: java.lang.NullPointerException
at org.omnifaces.facesviews.FacesViewsForwardingFilter.doFilter(FacesViewsForwardingFilter.java:122) [omnifaces-1.8.1.jar:1.8.1-20140603]
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77) [omnifaces-1.8.1.jar:1.8.1-20140603]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
2015-02-11 15:42:31,524 ERROR [io.undertow.request] (default task-15) UT005023: Exception handling request to /search.xhtml: java.lang.NullPointerException
at org.omnifaces.facesviews.FacesViewsForwardingFilter.doFilter(FacesViewsForwardingFilter.java:153) [omnifaces-1.8.1.jar:1.8.1-20140603]
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77) [omnifaces-1.8.1.jar:1.8.1-20140603]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
在服務器啓動期間,我看到的是:
2015-02-11 12:28:35,667 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /terms/index: java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.
at com.sun.faces.application.ApplicationImpl.setViewHandler(ApplicationImpl.java:583) [jsf-impl-2.2.8-jbossorg-1.jar:]
at javax.faces.application.ApplicationWrapper.setViewHandler(ApplicationWrapper.java:288) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
at org.jboss.as.jsf.injection.weld.ForwardingApplication.setViewHandler(ForwardingApplication.java:367) [wildfly-jsf-injection-8.2.0.Final.jar:8.2.0.Final]
at org.omnifaces.facesviews.FacesViewsForwardingFilter.init(FacesViewsForwardingFilter.java:95) [omnifaces-1.8.1.jar:1.8.1-20140603]
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:111) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:85)
在web.xml
相關的配置是:
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.html</url-pattern>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>/javax.faces.resource/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
<param-value>/*.xhtml</param-value>
</context-param>
這是如何引起的,我該如何解決?
什麼時候結束這些例外?你的意思是,當OmniFaces被移除時,你運行應用程序沒有任何問題? – Tiny 2015-02-11 18:11:51
這表明過濾器的init()失敗。你檢查過服務器的啓動日誌尋找可能與此有關的線索嗎?如何在'web.xml'中確切地配置FacesViews相關的上下文參數? – BalusC 2015-02-11 20:25:43
@Tiny我無法刪除omnifaces,因爲我的應用程序大量使用它。那些例外只出現在日誌文件中,我現在正在嘗試確定何時。我認爲它與過期的會話有關,但我仍然無法重現它。 我通過web.xml和faces-config.xml的內容擴展了我的文章。 – 2015-02-12 19:19:45