JSF 2.2中的SWF在com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome上导致java.lang.NullPointerException [英] SWF in JSF 2.2 causes java.lang.NullPointerException at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome

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

问题描述

我有一个JSF 2.2 + Spring WebFlow应用程序.当按下下面的命令按钮时

I've a JSF 2.2 + Spring WebFlow application. When the below command button is pressed

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

以下动作被调用

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

以及以下导航案例需要解决

and the following navigation case needs to be resolved

<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

这是怎么引起的,我该如何解决?

How is this caused and how can I solve it?

我将spring flow-web增加到了2.4.0版,但是我有同样的错误. 库中的jar列表中可能还有其他不一致之处. 这是完整的列表:

I increased spring flow-web to version 2.4.0 but I have the same error. Perhaps there are other inconsistencies in the list of jar in the library. Here is the complete list:

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) 我做了很多测试,最后更改了库和配置文件的列表,但是不幸的是,我仍然遇到相同的错误(具有相同的跟踪).


Updating (02/26/2015) I did many tests and I finally changed the list of libraries and configuration files but, unfortunately, I still have the same error (with same trace).

这是新的库列表

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的组合引起的.您需要将Spring WebFlow升级到JSF 2.2兼容版本,该版本至少为2.4.x.

This is caused by the combination Spring WebFlow 2.3.x and JSF 2.2. You need to upgrade Spring WebFlow to a JSF 2.2 compatible version, which is at least 2.4.x.

技术问题是,使用的SWF 2.3.x getFlowHandler() 被添加到Application中,而SWF没有正确委派该c3> ,因此返回了null,从而导致所有麻烦进一步地依赖于它不是null.如果SWF专家已经从ApplicationWrapper适当地扩展了,而不是为特定的JSF版本对所有委托方法进行硬编码,那么它将完美地通过JSF版本工作.

The technical problem is, SWF 2.3.x 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 SWF 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 SWF and thus returned null, causing all the trouble further down in the chain relying on it not being null. If SWF guys had properly extended from ApplicationWrapper instead of hardcoding all delegate methods for a specific JSF version, then it would flawlessly have worked through JSF versions.

  • Adding OmniFaces to JSF 2.2 with Weld app gives NullPointerException (exactly same problem with Weld)
  • faces-config with from-outcome not being string (boolean) fails with NullPointerException (exactly same problem with Seam)

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆