Announcement Announcement Module
Collapse
No announcement yet.
Unable to launch flow using Spring webflow 2.3.1 + Apache tiles 1.0.4 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to launch flow using Spring webflow 2.3.1 + Apache tiles 1.0.4

    Hello,

    I am using Spring 3.2 M2 + Spring webflow 2.3.1 + JSF 2.0. I am using Apache Tiles 2.0.5 for page layouts. When I am trying to launch the flow, I am getting FlowExecutionException. My flow is getting launched, but my view is not getting rendered.
    webflow-config.xml -
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:webflow="http://www.springframework.org/schema/webflow-config"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:faces="http://www.springframework.org/schema/faces"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/webflow-config
            http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
            http://www.springframework.org/schema/faces
            http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">
    
        <!-- Executes flows: the central entry point into the Spring Web Flow system -->
        <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry" >
            <webflow:flow-execution-listeners>
                <webflow:listener ref="facesContextListener"/>
                <webflow:listener ref="flowExecutionListener"/>
            </webflow:flow-execution-listeners>
        </webflow:flow-executor>
        <!-- A listener maintain one FacesContext instance per Web Flow request. -->
        <bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />	
        <bean id="flowExecutionListener" class="com.helloworld.FlowExecutionListener"/>
    
        <!-- The registry of executable flow definitions -->
        <webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices">
            <webflow:flow-location-pattern value="/WEB-INF/flows/flow-*.xml" />
        </webflow:flow-registry>
    
        <!-- Configures the Spring Web Flow JSF integration -->
        <faces:flow-builder-services id="facesFlowBuilderServices" view-factory-creator="mvcViewFactoryCreator"/>
        <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator" 
            p:viewResolvers-ref="viewResolver" />
        <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
            <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        </bean>    
        <faces:resources />
        <!-- Enables FlowHandlers -->
        <!-- Dispatches requests mapped to flows to FlowHandler implementations -->
    	<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter"  p:flowExecutor-ref="flowExecutor">
    		<property name="flowExecutor" ref="flowExecutor" />
            <property name="flowUrlHandler" ref="cassiopaeUrlHandler" />
    	</bean>
        <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
            <property name="order" value="1"/>
            <property name="flowRegistry" ref="flowRegistry" />
            <property name="flowUrlHandler" ref="urlHandler" />
        </bean>
        <!-- Custom Url Handler to indentify the flow Id from URL. With latest webflow _flowId=flow-test doesnt start web flow automatically. -->
        <bean id="urlHandler" class="com.helloworld.UrlHandler"/>
        <!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller implementations -->
        <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
    
    </beans>
    flow-test.xml -
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/webflow 
            http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
            start-state="test-components">
        <var name="testComponentBean" class="helloworld.TestComponentBean" />
        <view-state id="test-components" view="/jsp/flowToTilesView.jspx"/>
    </flow>
    web.xml
    Code:
    <servlet>
            <servlet-name>Spring Dispatcher Servlet</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/config/webflow-config.xml</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>Spring Dispatcher Servlet</servlet-name>
            <url-pattern>/faces/jsp/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
    I am launching the flow as http://HelloWord/faces/jsp/flowToTil...owId=test-flow.

    I am using tiles to render the definition that I receive from view id.
    flowToTilesView.jspx
    Code:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:tiles="http://tiles.apache.org/tags-tiles">
      <jsp:directive.page contentType="text/html;charset=utf-8"/>
      <jsp:useBean id="mapper" class="com.helloworld.TilesDefinitionMapperBean" scope="page"/>
      <tiles:insertDefinition name="${mapper.tilesDefinitionName}" flush="false"/>
    </jsp:root>
    TilesDefinitionMapperBean - Return the Id of the view-state. I have created tiles definition similar to view name
    Please let me know what I am missing.

    -Sujay
    Last edited by sujay@spring; Nov 21st, 2012, 12:57 PM. Reason: Correction in tiles version

  • #2
    When I am running my application, I am getting below exception. This exception is coming from f:view tag present from my HelloWorld.jspx


    Code:
    Caused By: java.lang.IllegalStateException: Exception occurred rendering view org.springframework.web.servlet.view.JstlView: name '/jsp/flowToTilesView.jspx'; URL [/jsp/flowToTilesView.jspx]
    	at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:191)
    	at org.springframework.webflow.engine.ViewState.render(ViewState.java:296)
    	at org.springframework.webflow.engine.ViewState.refresh(ViewState.java:243)
    	at org.springframework.webflow.engine.ViewState.resume(ViewState.java:221)
    	at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258)
    	at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
    	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    	at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:804)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:789)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at com.cj.trim.trimFilter.doFilter(Unknown Source)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at com.cj.gzipflt.GzipFilter.doFilter(Unknown Source)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    	at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    	at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    	at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    	at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused By: java.lang.NullPointerException
    	at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:684)
    	at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1311)
    	at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:197)
    	at jsp_servlet.__helloworld_jspx._jspService(__helloworld_jspx.java:88)
    	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    	at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
    	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    	at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    	at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    	at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    	at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)

    Comment

    Working...
    X