本文介绍了JSF 2.2中的Seam在com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome处导致java.lang.NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在使用Jboss 5.1构建的WildFly8.2上运行我的应用程序.我迁移了整个应用程序并能够看到登录页面.但是,当导航到JSF页面时,它会引发以下异常.

I am trying to run my application on WildFly8.2, which was build by using Jboss 5.1.I migrated my entire application and able to see the login page. But while navigating to JSF pages, it is throwing the below exception.

我的旧应用程序基于JSF 1.2

My old application is build on 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$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  at io.undertow.servlet.handlers.ServletInitialHandler$1.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$1.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 Jars,但是我正在调查这个问题.

I am suspecting that this issue is because of my jsf or rich faces jars, however I am looking into this issue.

请让我知道是否有人知道解决方案.

Please let me know if anyone knows the solution.

推荐答案

这是由Seam 2.3.x和JSF 2.2共同引起的.您需要迁移Seam DeltaSpike (与JSF 2.2兼容),或者在WildFly中将Mojarra 2.2.x降级到2.1.x.

This is caused by the combination Seam 2.3.x and JSF 2.2. You need to either migrate Seam to DeltaSpike, which is JSF 2.2 compatible, or to downgrade Mojarra 2.2.x in WildFly to 2.1.x.

技术问题是,Seam使用了一个Application实现,该实现未从 javax.faces.application.ApplicationWrapper ,因此必须手动将所有Application方法实现/委托给包装的应用程序.对于Seam 2.3.x,所有这些方法均基于JSF 2.1.在JSF 2.2中,一个新方法 getFlowHandler() 被添加到Application中,而Seam没有正确委派该c3> ,因此返回了null,从而导致了所有麻烦,因为它不是null而导致了进一步的麻烦.如果Seam伙计们已经从ApplicationWrapper适当地扩展了,而不是硬编码所有特定于JSF版本的委托方法,那么它将完美地适用于所有JSF版本.

The technical problem is, Seam used 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() was added to Application, which wasn't properly delegated by Seam and thus returned null, causing all the trouble further down in the chain relying on it not being null. If Seam guys had properly extended from ApplicationWrapper instead of hardcoding all delegate methods for a specific JSF version, then it would flawlessly have worked across JSF versions.

  • Weld in JSF 2.2 causes java.lang.NullPointerException at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome
    (exactly same problem with older Weld versions)
  • SWF in JSF 2.2 causes java.lang.NullPointerException at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome
    (exactly same problem with older Spring WebFlow versions)

这篇关于JSF 2.2中的Seam在com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome处导致java.lang.NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 09:55