带有from-outcome不是字符串(boolean)的faces-config失败,并出现NullPointerException [英] faces-config with from-outcome not being string (boolean) fails with NullPointerException
问题描述
我一直在将JSF 2.1与mojarra-2.1.20
一起使用,并且已经在我的faces-config.xml
中配置了这样的导航用例:
I've been using JSF 2.1 with mojarra-2.1.20
, and I've configured in my faces-config.xml
a navigation case like this:
<navigation-rule>
<from-view-id>/loggedOut.xhtml</from-view-id>
<navigation-case>
<from-action>#{sessionManager.isLoggedIn}</from-action>
<from-outcome>true</from-outcome>
<to-view-id>/login.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
The action is executed using seam-faces viewAction
(similiar to JSF 2.2 new tag). All has been working fine.
今天,我已使用mojarra-2.2.6
升级到JSF 2.2,并浏览到视图loggedOut.xhtml
停止工作.它会抛出此堆栈跟踪:
Today I've upgraded to JSF 2.2 with mojarra-2.2.6
, and browsing to the view loggedOut.xhtml
stoped working. It throws this stacktrace:
java.lang.NullPointerException
at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome(NavigationHandlerImpl.java:1342)
at com.sun.faces.application.NavigationHandlerImpl.findExactMatch(NavigationHandlerImpl.java:603)
at com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHandlerImpl.java:481)
at com.sun.faces.application.NavigationHandlerImpl.getNavigationCase(NavigationHandlerImpl.java:149)
at com.sun.faces.application.NavigationHandlerImpl.getNavigationCase(NavigationHandlerImpl.java:140)
at org.jboss.seam.faces.event.SeamPreNavigationHandler.getNavigationCase(SeamPreNavigationHandler.java:42)
at org.jboss.seam.faces.event.SeamPreNavigationHandler.handleNavigation(SeamPreNavigationHandler.java:57)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
at org.jboss.seam.faces.component.UIViewAction.broadcast(UIViewAction.java:381)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
...
我有更多这样的导航,所有导航都以相同的方式失败.此导航与其他情况和示例之间的唯一区别是from-outcome
值是boolean
而不是String
.所以我的问题是:
I have more navigations like this, and all of them fail in the same way. The only difference between this navigations and other cases and examples is that from-outcome
value is a boolean
and not a String
. So my questions are:
-
from-outcome
不是String
时会失败吗?- 如果是这样,应该不会因为出现更多可读"的消息而失败?
- 否则,是
mojara
错误吗?
- Should
from-outcome
's fail when it is not aString
?- If so, should not fail with a more "readable" message?
- Else, is a
mojara
bug?
我知道如何修复"它:使用
{dummyAction.execute}
并检查<if>
标记中的布尔值.但是我更喜欢执行真实的动作,而不是两种不同的动作.I know how to "fix it": using a
{dummyAction.execute}
and checking the boolean in the<if>
tag. But I prefered to execute the real action and not 2 differents.推荐答案
发布 @ glassfish ,并进行一些测试和调试,我发现真正的原因是弃用了第三方CDI扩展缝脸.
After posting @glassfish, and doing some testing and debugging, I found that the real cause is the deprecated thirdaparty CDI extension seam-faces.
随着它们的扩展
javax.faces.application.ApplicationWrapper
,但是代码是针对 JSF编译的2.1 ,方法As they extends the
javax.faces.application.ApplicationWrapper
, but the code is compiled against JSF 2.1, the method#getFlowHandler
returns alwaysnull
.这篇关于带有from-outcome不是字符串(boolean)的faces-config失败,并出现NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!