Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1319

The view path cannot be resolved if the flow is located in the classpath.

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: General Backlog
    • Component/s: JSF
    • Labels:
      None

      Description

      This may be related to http://jira.springframework.org/browse/SPR-4681 however it does not appear to be fixed in swf 2.0.1 and spring 2.5.4.

      The tomcat server that I deploy to has "unPackWars=false", therefore I keep my flows in the classpath. However, that means the view can't be resolved with a relative view path.

      I get:

      java.lang.IllegalStateException: A ContextResource is required to get relative view paths within this context
              at org.springframework.faces.webflow.JsfViewFactory.resolveViewName(JsfViewFactory.java:160)
              at org.springframework.faces.webflow.JsfViewFactory.getView(JsfViewFactory.java:84)
              at org.springframework.webflow.engine.ViewState.resume(ViewState.java:186)
              at org.springframework.webflow.engine.Flow.resume(Flow.java:535)
              at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
              at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:153)
              at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:173)
              at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:172)
              at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java
      :48)
              at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
              at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
              at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
              at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
              at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
              at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
              at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
              at java.lang.Thread.run(Thread.java:595)
      

      My config files:

      admin-webflow-config.xml:

      <?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:faces="http://www.springframework.org/schema/faces"
             xsi:schemaLocation="
                 http://www.springframework.org/schema/beans
                 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                 http://www.springframework.org/schema/webflow-config
                 http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
                 http://www.springframework.org/schema/faces
                 http://www.springframework.org/schema/faces/spring-faces-2.0.xsd">		
      
      	<!-- Executes flows: the central entry point into the Spring Web Flow system -->	
      	<webflow:flow-executor id="flowExecutor">
      		<webflow:flow-execution-listeners>
      			<webflow:listener ref="adminFlowExecutionListener" />
      		</webflow:flow-execution-listeners>
      	</webflow:flow-executor>
      	
      	<!-- Creates the registry of flow definitions for this application -->
      	<webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices">
      		<webflow:flow-location path="classpath:flows/admin/admin.xml"/>
      	</webflow:flow-registry>
      
      	<!-- Configures the Spring Web Flow JSF integration -->
      	<faces:flow-builder-services id="facesFlowBuilderServices" />
      
      </beans>
      

      admin-webmvc-config.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
             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-2.5.xsd">
      
      	<!-- Maps request URIs to controllers -->			
      	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
      		<property name="mappings">
      			<props>
                      <prop key="*/admin">flowController</prop>
                  </props>
      		</property>
      		<property name="defaultHandler">
      			<!-- Selects view names to render based on the request URI: e.g. /main selects "main" -->	
      			<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
      		</property>
      	</bean>
      
      	<!-- Handles requests mapped to the Spring Web Flow system -->
      	<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
      		<property name="flowExecutor" ref="flowExecutor"/>
      	</bean>
      
      	<!-- Maps logical view names to Facelet templates (e.g. 'login' to '/WEB-INF/layouts/login.xhtml' -->
      	<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/layouts/" />
      		<property name="suffix" value=".xhtml" />
      	</bean>
      
      </beans>
      

      admin-application-config.xml:

      <?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:context="http://www.springframework.org/schema/context"
      	xsi:schemaLocation="
      		http://www.springframework.org/schema/beans
      		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
      		http://www.springframework.org/schema/context
      		http://www.springframework.org/schema/context/spring-context-2.5.xsd">
      	
      	<bean id="admin" class="com.phantom.client.web.application.AdminApplication" />
      	
      	<!-- Imports the configurations of the different infrastructure systems of the application -->
      	<import resource="admin-webmvc-config.xml" />
      	<import resource="admin-webflow-config.xml" />
      
      </beans>
      

      web.xml:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
          version="2.4">
      	
      	<context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>
      			/WEB-INF/config/admin-application-config.xml
      		</param-value>
      	</context-param>
      	
      	<listener>
      		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      	</listener>
      
      	<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
      	<servlet>
      		<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
      		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      		<init-param>
      			<param-name>contextConfigLocation</param-name>
      			<param-value></param-value>
      		</init-param>
      		<load-on-startup>2</load-on-startup>
      	</servlet>
      	
      	<servlet-mapping>
      		<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
      		<url-pattern>/spring/*</url-pattern>
      	</servlet-mapping>
      
      ...
      
      </web-app>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwebb Phil Webb
                Reporter:
                jamesff James ffolliott
              • Votes:
                10 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: