Announcement Announcement Module
Collapse
No announcement yet.
Webflow 2.2 problem when using MVC view resolver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webflow 2.2 problem when using MVC view resolver

    Hello,

    currently I experiment with the new Webflow 2.2 release and JSF 2. Using the spring JSF booking sample app as foundation I created a minimal app and try to change some details.

    First of all I would like to use the Spring MVC view resolver for resolving Webflow views. For that I added the folowing snippets to the Webflow config file:

    Code:
    <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
      <property name="viewResolvers" ref="faceletsViewResolver" />
    </bean>
    and I added this bean to the flow-builder-services:

    Code:
    <faces:flow-builder-services id="facesFlowBuilderServices" view-factory-creator="mvcViewFactoryCreator" development="true" />
    mvcViewFactoryCreator is defined as follows:

    Code:
    <bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
      <property name="viewClass" value="org.springframework.faces.mvc.JsfView" />
      <property name="prefix" value="/WEB-INF/pages/" />
      <property name="suffix" value=".xhtml" />
    </bean>
    After moving the xhtml pages to the correct location the single views are accessible. But starting the flow results in the following error:

    Code:
    10:11:01,734 DEBUG FlowHandlerMapping:108 - Mapping request with URI '/webflow/spring/test' to flow with id 'test'
    10:11:01,734 DEBUG FlowExecutorImpl:161 - Resuming flow execution with key 'e1s1
    10:11:01,734 DEBUG SessionBindingConversationManager:67 - Locking conversation 1
    10:11:01,750 DEBUG DefaultFlowExecutionRepository:103 - Getting flow execution with key 'e1s1'
    10:11:01,750 DEBUG FlowDefinitionRegistryImpl:59 - Getting FlowDefinition with id 'test'
    10:11:01,750 DEBUG ConditionalFlowExecutionListenerLoader:87 - Loaded [1] of possible 1 listeners for this execution request for flow 'test', the listeners to attach are list[org.springframework.faces.webflow.FlowFacesContextLifecycleListener@1786286]
    10:11:01,750 DEBUG FlowExecutionImpl:250 - Resuming in org.springframework.webflow.mvc.servlet.MvcExternalContext@2f996f
    10:11:01,750 DEBUG ViewState:307 - Rendering + [ServletMvcView@10278c5 view = org.springframework.faces.mvc.JsfView: name 'test/testStart'; URL [/WEB-INF/pages/test/testStart.xhtml]]
    10:11:01,750 DEBUG ViewState:308 -   Flash scope = map[[empty]]
    10:11:01,750 DEBUG ViewState:309 -   Messages = [DefaultMessageContext@146df77 sourceMessages = map[[null] -> list[[empty]]]]
    10:11:01,750 DEBUG AbstractMvcView:178 - Rendering MVC [org.springframework.faces.mvc.JsfView: name 'test/testStart'; URL [/WEB-INF/pages/test/testStart.xhtml]] with model map [{flowRequestContext=[RequestControlContextImpl@1f93ace externalContext = [email protected], currentEvent = [null], requestScope = map[[empty]], attributes = map[[empty]], messageContext = [DefaultMessageContext@146df77 sourceMessages = map[[null] -> list[[empty]]]], flowExecution = [FlowExecutionImpl@183d260 flow = 'test', flowSessions = list[[FlowSessionImpl@168afdd flow = 'test', state = 'testStart', scope = map['viewScope' -> map[[empty]]]]]]], flashScope=map[[empty]], currentUser=null, flowExecutionKey=e1s1, flowExecutionUrl=/webflow/spring/test?execution=e1s1, viewScope=map[[empty]]}]
    10:11:01,750 DEBUG RequestLoggingPhaseListener:42 - Entering JSF Phase: RESTORE_VIEW 1
    10:11:01,750 DEBUG JsfView:82 - Asking faces lifecycle to render
    10:11:01,750 DEBUG RequestLoggingPhaseListener:42 - Entering JSF Phase: RENDER_RESPONSE 6
    10:11:01,765 DEBUG JsfView:85 - View rendering complete
    10:11:01,765 ERROR FlowExecutionImpl:276 - FlowExecutionListener threw exception
    java.lang.NullPointerException
    	at org.springframework.faces.webflow.FlowFacesContextLifecycleListener.requestProcessed(FlowFacesContextLifecycleListener.java:45)
    	at org.springframework.webflow.engine.impl.FlowExecutionListeners.fireRequestProcessed(FlowExecutionListeners.java:98)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:274)
    	at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
    	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	at java.lang.Thread.run(Thread.java:619)
    10:11:01,765 DEBUG DefaultFlowExecutionRepository:118 - Putting flow execution '[FlowExecutionImpl@183d260 flow = 'test', flowSessions = list[[FlowSessionImpl@168afdd flow = 'test', state = 'testStart', scope = map['viewScope' -> map[[empty]]]]]]' into repository
    10:11:01,765 DEBUG DefaultFlowExecutionRepository:125 - Adding snapshot to group with id 1
    10:11:01,765 DEBUG SessionBindingConversationManager:78 - Putting conversation attribute 'scope' with value map['flashScope' -> map['messagesMemento' -> map[[empty]]]]
    10:11:01,765 DEBUG SessionBindingConversationManager:99 - Unlocking conversation 1
    Only the first view of the flow is shown, but the navigation is not working anymore. Without changing the view resolving everything works as expected.

    Could you please help me. Thanks in advance.

    Greetings, Dieter

  • #2
    I think the JsfView is releasing the context. Would you mind opening a ticket in JIRA?

    Comment


    • #3
      I created a JIRA Ticket under SWF-1407.

      So you think it's a bug?

      Comment


      • #4
        We are facing the same issue with spring webflow 2.2.1 using:

        Code:
        2010-12-17 13:45:12,420 [DEBUG,RequestLoggingPhaseListener,http-8080-1] Entering JSF Phase: RENDER_RESPONSE 6
        2010-12-17 13:45:12,443 [ERROR,FlowExecutionImpl,http-8080-1] FlowExecutionListener threw exception
        java.lang.NullPointerException
        	at org.springframework.faces.webflow.FlowFacesContextLifecycleListener.requestProcessed(FlowFacesContextLifecycleListener.java:45)
        	at org.springframework.webflow.engine.impl.FlowExecutionListeners.fireRequestProcessed(FlowExecutionListeners.java:98)
        	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:274)
        	at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
        	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
        	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
        	at de.hvbps.ewms.web.EWMSDispatcherServlet.doDispatch(EWMSDispatcherServlet.java:65)
        	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
        	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at de.hvb.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:130)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        our configuration is like this:

        Code:
            <bean id="ajaxViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver">
                <property name="viewClass" value="de.hvbps.ewms.web.spring.AjaxTiles21View"/>
            </bean>
        
            <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
              <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
            </bean>
        Code:
            <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
        		<property name="useSpringBeanBinding" value="true" />
        		<property name="viewResolvers">
        			<list>
        				<ref bean="viewResolver"/>
        				<ref bean="ajaxViewResolver"/>
        			</list>
        		</property>
        	</bean>
        might it be a bug too?

        any help highly appreciated

        Comment


        • #5
          The issue described above was fixed. Are you sure you're running with 2.2.1 jars? This is the change you need.

          If you are running with that change, then something else is releasing the FacesContext. Could it be something in your code? Or another library?

          Comment


          • #6
            Thanks for your immediate response.

            Yes, we are definitely using webflow 2.2.1 along with spring-faces 2.2.1, primfaces 2.2rc2, jsf-api 2.1 and spring 3.0.5.

            I will debug it next week and maybe i can figure out why it is reseted.

            Comment


            • #7
              No NPE with 2.2.1 but no page navigation

              Hello,

              sorry for the late reply.

              In my configuration the NPEs are gone, but page navigation is not working. So I created a JIRA subtask with the id SWF-1439.

              Can anyone reproduce this behaviour or is it my mistake.

              Thanks and greetings,

              Dieter

              Comment


              • #8
                the NPE does not occur anymore with jsf-api and jsf-impl 2.0.3 (with 2.0.2 we got the NPE even with webflow 2.2.1)

                Comment


                • #9
                  Hello

                  I'm trying to integrate JSF2 & SWF 2.2(and later) and encounter the following exception in the log.
                  I've tried different combinations of the binaries(JSF 2.0.3, 2.0.6, 2.1), SWF(2.2.1, 2.3.1) without success.
                  Please advise on possible solutions.

                  ERROR FlowExecutionImpl : FlowExecutionListener threw exception
                  java.lang.NullPointerException
                  at org.springframework.faces.webflow.FlowFacesContext LifecycleListener.requestProcessed(FlowFacesContex tLifecycleListener.java:45)
                  at org.springframework.webflow.engine.impl.FlowExecut ionListeners.fireRequestProcessed(FlowExecutionLis teners.java:98)
                  at org.springframework.webflow.engine.impl.FlowExecut ionImpl.start(FlowExecutionImpl.java:237)
                  at org.springframework.webflow.executor.FlowExecutorI mpl.launchExecution(FlowExecutorImpl.java:140)
                  at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(FlowHandlerAdapter.java:193)
                  at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:788)
                  at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:717)
                  at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:644)
                  at org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:549)
                  at javax.servlet.http.HttpServlet.service(HttpServlet .java:621)
                  at javax.servlet.http.HttpServlet.service(HttpServlet .java:722)
                  at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:305)
                  at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:210)
                  at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:684)
                  at org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:473)
                  at org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:402)
                  at org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:329)
                  at org.apache.catalina.core.StandardHostValve.custom( StandardHostValve.java:453)
                  at org.apache.catalina.core.StandardHostValve.status( StandardHostValve.java:324)
                  at org.apache.catalina.core.StandardHostValve.throwab le(StandardHostValve.java:415)
                  at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:191)
                  at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98)
                  at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:927)
                  at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:118)
                  at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:407)
                  at org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:987)
                  at org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:579)
                  at org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:307)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
                  at java.lang.Thread.run(Unknown Source)

                  Comment

                  Working...
                  X