Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: 1.1M1 snapshot, <flow:enable-scopes>

  1. #1

    Default 1.1M1 snapshot, <flow:enable-scopes>

    I tried 1.1M1 snapshot, <flow:enable-scopes>.
    However, I failed to launch a new flow.

    summary of stacktrace:
    Code:
    2007-05-08 15:31:24,921 [http-8080-Processor25] ERROR org.apache.myfaces.lifecycle.PhaseListenerManager - Exception in PhaseListener RESTORE_VIEW(1) beforePhase.
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PhonebookFlowData': Scope 'flow' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No flow execution context is bound to this thread
    Caused by: 
    java.lang.IllegalStateException: No flow execution context is bound to this thread
        at org.springframework.util.Assert.state(Assert.java:354)
        at org.springframework.webflow.execution.FlowExecutionContextHolder.getFlowExecutionContext(FlowExecutionContextHolder.java:55)
        at org.springframework.webflow.config.scope.AbstractWebFlowScope.getFlowExecutionContext(AbstractWebFlowScope.java:113)
        at org.springframework.webflow.config.scope.FlowScope.getScope(FlowScope.java:32)
    
        ...
    
        at org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(FlowDefinitionRegistryImpl.java:128)
        at org.springframework.webflow.executor.jsf.FlowPhaseListener.restoreFlowExecution(FlowPhaseListener.java:310)
    
        ...
    For more details:
    http://opensource.atlassian.com/proj...browse/SWF-163

  2. #2
    Join Date
    Jan 2006
    Location
    Southampton, UK
    Posts
    117

    Default Details

    If possible can I get some additional information from you? Specifically from the issue, what does 'PhonebookFlowAction refers PhonebookFlowData' mean? Is PhonebookFlowData passed in as an argument to the bean or is gained by dependency injection? Second, can you post in what your faces-config file shows?

    -Ben Hale
    Ben Hale
    tc Server Team Core Developer
    http://www.springsource.com/products/tcserver

  3. #3

    Default

    Spring beans:
    Code:
      <bean name="PhonebookFlowAction"
          class="foo.phonebook.PhonebookFlowAction"
          scope="request"
          autowire="byType"
          dependency-check="objects">
    
      </bean>
    
      <bean name="PhonebookFlowData"
          class="foo.phonebook.PhonebookFlowData"
          scope="flow"
          autowire="no"
          dependency-check="none">
    
      </bean>
    
      <flow:executor id="flowExecutor" registry-ref="flowRegistry">
        <flow:repository type="simple" />
        <flow:execution-listeners>
          <flow:listener ref="jsfFlashMessageListener" />
        </flow:execution-listeners>
      </flow:executor>
    
      <flow:registry id="flowRegistry">
        <flow:location path="/WEB-INF/classes/foo/phonebook/**/*Flow.xml" />
      </flow:registry>
    
      <flow:enable-scopes />
    
      <bean id="jsfFlashMessageListener"
          class="foo.message.JsfFlashMessageListener" />
    
      ...
    faces-config.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE faces-config PUBLIC
        "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
        "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
    
      <application>
        <navigation-handler>
          org.springframework.webflow.executor.jsf.FlowNavigationHandler
        </navigation-handler>
        <variable-resolver>
          org.springframework.webflow.executor.jsf.DelegatingFlowVariableResolver
        </variable-resolver>
      </application>
    
      <lifecycle>
        <phase-listener>
          org.springframework.webflow.executor.jsf.FlowPhaseListener
        </phase-listener>
      </lifecycle>
    
      <!-- for MyFaces -->
      <converter>
        <converter-for-class>java.math.BigDecimal</converter-for-class>
        <converter-class>javax.faces.convert.BigDecimalConverter</converter-class>
      </converter>
      <converter>
        <converter-for-class>java.math.BigInteger</converter-for-class>
        <converter-class>javax.faces.convert.BigIntegerConverter</converter-class>
      </converter>
    
    </faces-config>

  4. #4
    Join Date
    Jan 2006
    Location
    Southampton, UK
    Posts
    117

    Default

    How are you achieving the request scope for the FlowAction? Are you using Spring's RequestContextListener?
    Ben Hale
    tc Server Team Core Developer
    http://www.springsource.com/products/tcserver

  5. #5

    Default

    No. I'm using RequestContextFilter.

    Code:
      <filter>
        <filter-name>RequestContextFilter</filter-name>
        <filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
      </filter>
    
      <filter-mapping>
        <filter-name>RequestContextFilter</filter-name>
        <url-pattern>*.faces</url-pattern>
      </filter-mapping>
    
      <filter-mapping>
        <filter-name>RequestContextFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
      </filter-mapping>

  6. #6

    Default

    Probably

    FlowPhaseListener.java:
    310 FlowDefinition flowDefinition = getLocator(context).getFlowDefinition(flowId);
    -> IllegalStateException
    313 FlowExecutionHolderUtils.setFlowExecutionHolder(ho lder, facesContext);
    -> flow-scoped bean enabled.

  7. #7
    Join Date
    Jan 2006
    Location
    Southampton, UK
    Posts
    117

    Default

    It appears that the problem is how you are initializing your beans with different scopes. Since the request scope is created and initialized at a different time (in this case before) the flow scope is, when you try and do dependency injection it will fail with the exception you showed. There are two ways to solve this problem.

    First, you can solve this particular issue by simply adding <aop:scoped-proxy/> to your data bean if it implements an interface (http://static.springframework.org/sp...her-injection).

    Code:
    <bean name="PhonebookFlowData"
            class="foo.phonebook.PhonebookFlowData"
            scope="flow"
            autowire="no"
            dependency-check="none">
        <aop:scoped-proxy/>
    </bean>
    Basically what will happen is a proxy will be injected in place of the real bean when the FlowAction is created. Then when the real object is needed (presumably within the flow execution) it will be looked up by the proxy and there should be no issue.

    That solution should solve the symptom you're seeing, but really you should think about a different manner of getting data to the FlowAction. Really you should be looking to have a conversation-scoped data object that is being bound to by the JSF components and then pass it as an argument to some method on the FlowAction. This way there is no dependency that needs to be proxied out and lazily injected.
    Ben Hale
    tc Server Team Core Developer
    http://www.springsource.com/products/tcserver

  8. #8

    Default

    By adding <aop:scoped-proxy />, I can launch a new flow.
    However JSF value binding (ex. value="#{PhonebookFlowData.list}") does not work.
    In the flow scope,
    "PhonebookFlowData" attribute does not exist,
    and "scopedTarget.PhonebookFlowData" exists.
    This is caused by <aop:scoped-proxy />.

  9. #9

    Default

    Sorry.
    By adding org.springframework.web.jsf.DelegatingVariableReso lver,
    value binding works well.
    Thanks for your help.

  10. #10

    Default

    JSF deferred expression (ex. value="#{PhonebookFlowData.list}") works,
    but immediate expression (ex. value="${PhonebookFlowData.list}") does not work.

    I expected that the bean of bean-action is instantiated when action performed.
    However, the bean is instantiated before the start of the flow.
    Can I delay the creation of the bean?
    Or, do other ways exist?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •