1

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

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

the following action is invoked

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>

the following exception is being thrown

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?


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

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).

Here is the new list of libraries

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

There seems to be an incompatibility between libraries.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
vince
  • 11
  • 3
  • your PageController class how you have annotated? – Joe Taras Feb 19 '15 at 11:43
  • Spring WebFlow is at fault here. Which version exactly is it? Tried upgrading to latest? In future questions, always mention the exact versions of libraries involved in the application (at least, the ones involved in stack trace). – BalusC Feb 19 '15 at 11:48
  • I have put PageController in faces.config.xml – vince Feb 19 '15 at 11:51
  • 1
    Ignore Joe, he didn't understood the stack trace. That PageController information is irrelevant. In future JSF related questions, also avoid putting [java] tag on the question. It'll only attract users knowing nothing about JSF and related libraries and thus post confusing comments asking for irrelevant information. – BalusC Feb 19 '15 at 11:52
  • Spring-webflow-2.3.2_RELEASE.jar – vince Feb 19 '15 at 11:59

1 Answers1

1

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.

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.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 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. I have added in question the complete list. – vince Feb 19 '15 at 18:21
  • With exactly the same stack trace? If so, then it isn't properly cleaned/rebuilt. – BalusC Feb 19 '15 at 19:18
  • 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). The new list of libraries is shown in the update of the application – vince Feb 26 '15 at 16:47
  • You've both SWF 2.3.2 and 2.4.0 in the list..? – BalusC Feb 28 '15 at 11:44