JSF 2.2中的SWF导致com.sun.faces.application.NavigationHandlerImp



我有一个JSF 2.2+Spring WebFlow应用程序。按下以下命令按钮时

<h:commandButton value="Aggiungi" action="#{pageController.modifica}" /> 

调用以下操作

public String modifica() {
    // ...
    return "gest";
}

并且以下导航情况需要解决

<navigation-case>
    <from-action>#{pageController.modifica}</from-action>
    <from-outcome>gest</from-outcome>
    <to-view-id>/newxhtml.xhtml</to-view-id>
    <redirect />
</navigation-case>

正在引发以下异常

java.lang.NullPointerException
    at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome(NavigationHandlerImpl.java:1204)
    at com.sun.faces.application.NavigationHandlerImpl.findExactMatch(NavigationHandlerImpl.java:568)
    at com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHandlerImpl.java:462)
    at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:189)
    at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:182)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
    at org.springframework.faces.webflow.FlowActionListener.processAction(FlowActionListener.java:71)
    at org.springframework.faces.model.SelectionTrackingActionListener.processAction(SelectionTrackingActionListener.java:55)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    ... 63 more

这是怎么造成的,我该如何解决?


我将springflow web增加到2.4.0版本,但我也有同样的错误。也许在库中的jar列表中还有其他不一致的地方。以下是完整的列表:

19/02/2015  17.44             4.467 aopalliance-1.0.jar
19/02/2015  17.44           304.373 commons-fileupload-1.3-javadoc.jar
19/02/2015  17.44            86.398 commons-fileupload-1.3-sources.jar
19/02/2015  17.44            36.475 commons-fileupload-1.3-test-sources.jar
19/02/2015  17.44            49.314 commons-fileupload-1.3-tests.jar
19/02/2015  17.44            67.986 commons-fileupload-1.3.jar
19/02/2015  17.44            62.050 commons-logging-1.1.3.jar
19/02/2015  17.44             2.497 javax.inject-1.jar
19/02/2015  17.44           634.222 jsf-api-2.1.7.jar
19/02/2015  17.44         1.962.213 jsf-impl-2.1.7.jar
19/02/2015  17.44           100.636 jsp-api-2.1.jar
19/02/2015  17.44           414.240 jstl-1.2.jar
19/02/2015  17.44           954.038 mysql-connector-java-5.1.30.jar
19/02/2015  17.44           592.322 postgresql-9.3-1102.jdbc41.jar
19/02/2015  17.44         1.824.331 primefaces-3.5.jar
19/02/2015  19.04                 0 print.txt
19/02/2015  17.44           105.112 servlet-api-2.5.jar
19/02/2015  17.44            29.868 smoothness-1.0.10.jar
19/02/2015  17.44           337.694 spring-aop-3.2.8.RELEASE.jar
19/02/2015  17.44           612.569 spring-beans-3.2.8.RELEASE.jar
19/02/2015  17.44           148.444 spring-binding-2.3.2.RELEASE.jar
19/02/2015  17.44           866.273 spring-context-3.2.8.RELEASE.jar
19/02/2015  17.44           873.608 spring-core-3.2.8.RELEASE.jar
19/02/2015  17.44           196.367 spring-expression-3.2.8.RELEASE.jar
19/02/2015  17.44           194.947 spring-faces-2.3.2.RELEASE.jar
19/02/2015  17.44           405.717 spring-jdbc-3.2.8.RELEASE.jar
19/02/2015  17.44            17.381 spring-js-2.3.2.RELEASE.jar
19/02/2015  17.44         4.412.472 spring-js-resources-2.3.2.RELEASE.jar
19/02/2015  17.44            83.412 spring-security-acl-3.2.3.RELEASE.jar
19/02/2015  17.44           406.536 spring-security-config-3.2.3.RELEASE.jar
19/02/2015  17.44           359.633 spring-security-core-3.2.3.RELEASE.jar
19/02/2015  17.44           342.300 spring-security-web-3.2.3.RELEASE.jar
19/02/2015  17.44           242.436 spring-tx-3.2.8.RELEASE.jar
19/02/2015  17.44           628.456 spring-web-3.2.8.RELEASE.jar
19/02/2015  17.44           565.416 spring-webflow-2.4.0.RELEASE.jar
19/02/2015  17.44           637.903 spring-webmvc-3.2.8.RELEASE.jar

更新(2015年2月26日)我做了很多测试,最终更改了库和配置文件的列表,但不幸的是,我仍然有相同的错误(具有相同的跟踪)。

这是图书馆的新列表

aopalliance-1.0.jar
commons-fileupload-1.3-javadoc.jar
commons-fileupload-1.3-sources.jar
commons-fileupload-1.3-test-sources.jar
commons-fileupload-1.3-tests.jar
commons-fileupload-1.3.jar
commons-logging-1.1.3.jar
javax.inject-1.jar
jsf-api-2.1.7.jar
jsf-api-2.2.0-m03.jar
jsf-impl-2.1.7.jar
jsf-impl-2.2.0.jar
jsp-api-2.1.jar
jstl-1.2.jar
mysql-connector-java-5.1.30.jar
org.springframework.binding-2.0.5.RELEASE.jar
postgresql-9.3-1102.jdbc41.jar
primefaces-3.5.jar
servlet-api-2.5.jar
smoothness-1.0.10.jar
spring-aop-3.2.6.RELEASE.jar
spring-beans-4.0.2.RELEASE.jar
spring-binding-2.4.0.RELEASE.jar
spring-context-4.0.2.RELEASE.jar
spring-core-4.0.2.RELEASE.jar
spring-expression-4.0.2.RELEASE.jar
spring-faces-2.3.1.RELEASE.jar
spring-jdbc-4.0.2.RELEASE.jar
spring-js-2.4.0.RELEASE.jar
spring-js-resources-2.4.0.RELEASE.jar
spring-jsf.jar
spring-orm-4.0.2.RELEASE.jar
spring-security-config-3.2.3.RELEASE.jar
spring-security-core-3.2.0.RELEASE.jar
spring-security-taglibs-3.2.3.RELEASE.jar
spring-security-web-3.2.3.RELEASE.jar
spring-tx-4.0.2.RELEASE.jar
spring-web-4.0.2.RELEASE.jar
spring-webflow-2.3.2.RELEASE.jar
spring-webflow-2.4.0.RELEASE.jar
spring-webmvc-4.0.2.RELEASE.jar
spring-webmvc-portlet-4.0.2.RELEASE.jar

库之间似乎不兼容。

这是由Spring WebFlow 2.3.x和JSF 2.2的组合引起的。您需要将SpringWebFlow升级到与JSF 2.2兼容的版本,该版本至少为2.4.x.

技术问题是,SWF2.3.x使用了一个Application实现,该实现没有从javax.faces.application.ApplicationWrapper正确扩展,因此它必须手动实现/委托所有Application方法给封装的应用程序。在SWF2.3.x的情况下,所有这些方法都是基于JSF2.1的。在JSF 2.2中,向Application添加了一个新方法getFlowHandler(),但SWF没有正确地委托该方法,因此返回了null,这导致了链中所有的麻烦,因为它不是null。如果SWF人员正确地从ApplicationWrapper扩展,而不是为特定的JSF版本硬编码所有委托方法,那么它将完美地工作在JSF版本中。

另请参阅:

  • 使用Weld应用程序将OmniFaces添加到JSF 2.2中会出现NullPointerException(与Weld完全相同的问题)
  • 来自结果不是字符串(布尔值)的faces配置失败,出现NullPointerException(与Seam完全相同的问题)

相关内容

  • 没有找到相关文章

最新更新