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

时间:2015-02-19 11:39:20

标签: jsf navigation spring-webflow jsf-2.2

我是一个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

这是如何引起的?如何解决?


我将spring flow-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

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

这是新的库列表

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

库之间似乎存在不兼容性。

1 个答案:

答案 0 :(得分:1)

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

技术问题是,SWF 2.3.x使用的an Application implementation没有从javax.faces.application.ApplicationWrapperit had to manually implement/delegate all Application methods to the wrapped application正确延伸。对于SWF 2.3.x,所有这些方法都基于JSF 2.1。在JSF 2.2中,Application添加了一个新方法getFlowHandler(),该方法未被SWF正确委派,因此返回null,导致依赖链中的所有问题进一步降低它不是null。如果SWF人员从ApplicationWrapper正确扩展而不是硬编码特定JSF版本的所有委托方法,那么它将完美地通过JSF版本。

另见: