JSF 2.2 中的接缝导致 java.lang.NullPointerException 在 com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome

Seam in JSF 2.2 causes java.lang.NullPointerException at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome

我正在尝试 运行 我在 WildFly8.2 上的应用程序,它是使用 Jboss 5 构建的。1.I 迁移了我的整个应用程序并能够看到登录页面。但是在导航到 JSF 页面时,它会抛出以下异常。

我的旧应用程序是基于 JSF 1.2 构建的

2015-07-15 14:49:02,108 INFO          [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1)     Initializing Mojarra 2.2.8-jbossorg-1 20140822-1131 for context '/booking'
    2015-07-15 14:49:03,303 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017534: Registered web context: /booking
2015-07-15 14:49:03,402 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "booking.ear" (runtime-name : "booking.ear")
2015-07-15 14:49:03,508 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:10190/management
2015-07-15 14:49:03,514 INFO  [org.jboss.as] (Controller Boot Thread)     JBAS015951: Admin console listening on http://127.0.0.1:10190
2015-07-15 14:49:03,519 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 15104ms - Started 637 of 711 services (124 services are lazy, passive or on-demand)
2015-07-15 14:50:12,989 INFO  [org.jboss.seam.servlet.SeamFilter] (default task-1) Initializing filter: org.jboss.seam.web.redirectFilter
2015-07-15 14:50:12,993 INFO  [org.jboss.seam.servlet.SeamFilter] (default task-1) Initializing filter: org.jboss.seam.web.exceptionFilter
2015-07-15 14:50:12,995 INFO  [org.jboss.seam.servlet.SeamFilter] (default task-1) Initializing filter: org.jboss.seam.web.multipartFilter
2015-07-15 14:50:12,996 INFO  [org.jboss.seam.servlet.SeamFilter] (default task-1) Initializing filter: org.jboss.seam.web.loggingFilter
2015-07-15 14:50:12,998 INFO  [org.jboss.seam.servlet.SeamFilter] (default task-1) Initializing filter: org.jboss.seam.web.identityFilter
2015-07-15 14:50:20,699 ERROR [org.jboss.seam.exception.Exceptions] (default task-13) handled and logged exception: javax.servlet.ServletException
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]
  at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:2.3.1.Final]
  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]
  at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.ServletInitialHandler.access[=12=]0(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.server.HttpServerExchange.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_11]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_11]
  at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_11]
Caused by: java.lang.NullPointerException
  at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome(NavigationHandlerImpl.java:1341) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.findWildCardMatch(NavigationHandlerImpl.java:661) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHandlerImpl.java:483) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:190) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:183) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:49) [jboss-seam.jar:2.3.1.Final]
  at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
  at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
  at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
  at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.8-jbossorg-1.jar:]
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
  ... 42 more

我怀疑这个问题是因为我的 jsf 或 rich faces jar,但是我正在调查这个问题。

如果有人知道解决方案,请告诉我。

我已经确定了根本原因,问题是因为 jar 版本,将 jar 版本降级到 2.1.29-jbossorg-1,它对我有用。

为此,将 jar 添加到 ${JBOSS_HOME}/modules/system/layers/base/com/sun/jsf-impl/main/ 并更新 module.xml(在同一路径中可用) "resource-root" 标记指向新文件名。

参考:https://developer.jboss.org/thread/261071?sr=inbox&ru=123215

这是由 Seam 2.3.x 和 JSF 2.2 的组合引起的。您需要将 WildFly 中的 migrate Seam to DeltaSpike, which is JSF 2.2 compatible, or to downgrade Mojarra 2.2.x 更改为 2.1.x.

技术问题是,Seam 使用的 an Application implementation which didn't properly extend from javax.faces.application.ApplicationWrapper and thus it had to manually implement/delegate all Application methods to the wrapped application. In case of Seam 2.3.x, all those methods were based on JSF 2.1. In JSF 2.2, a new method getFlowHandler() 被添加到 Application,Seam 没有正确委托,因此返回 null,导致所有问题进一步向下依赖它的链不是 null。如果 Seam 人员正确地从 ApplicationWrapper 扩展而不是对特定 JSF 版本的所有委托方法进行硬编码,那么它将完美地跨 JSF 版本工作。

另请参阅: