7 Replies Latest reply on Apr 16, 2006 1:49 PM by Louis Coetzee

    @Conversational with s:link

    Louis Coetzee Apprentice

      Hi,

      I have been trying to establish whether the @Conversational still works with the s:link. This is a slightly convoluted (and at this point artificial) description but does highlight my problem.

      I have a Stateful bean (x) annotated with @Conversational (ifNotBegunOutcome="home")

      in bean x I have a method doSomething with an xhtml page pointing to this method with s:link.. something like <s:link action="#{x.doSomething}" />

      I also have another bean (y) with a method doSomethingElse where I end the conversation. Something like <s:link action="#{y.doSomethingElse}" propagation="end" /> . This link is also on the same xhtml page and returns to this page (where both links are).

      At some point a conversation is started and we end up on the xhtml page.

      In theory by selecting the link to y.doSomethingElse the conversation is ended and we have no current conversation. Then when we select the link to x.doSomething the @Conversational should kick in and direct me to the "home". My feeling however is that it does not as the x.doSomething gets invoked. Obviously there is no conversation stuff left, resulting in lots of NPE's.

      In a way I guess the same kind of thing happens when the person is viewing the xhtml page, but is inactive for some time (enough for the conversation to time out, but not long enough for the session to expire). When the link to x.doSomething is clicked it gets invoked instead of the @Conversational intercepting and redirecting the person (but it is quite difficult to see when the conversation has actually timed-out).

      I will try and build a real (small) application to check if this really is the case, but I am curious if other "Seamers" have noticed the same behavior with the @Conversational not intercepting ?

      Regards

      Louis

        • 1. Re: @Conversational with s:link
          Louis Coetzee Apprentice

          I have built a small application with a stateful bean annotated with @Conversational containing two methods:

          @Stateful
          @Name("serviceManagementBean")
          @Conversational(ifNotBegunOutcome = "AdminHomePage")
          @Interceptors(SeamInterceptor.class)
          public class ServiceManagementBean implements Serializable, ServiceManagement {
          .....
          
          public String doSomething() {
           logger.info("doSomething");
           return null;
          }
          public String doSomethingElse() {
           logger.info("doSomethingElse. Ends conversation");
           return null;
          }


          and invoked from a view using s:link
          <s:link action="#{serviceManagementBean.doSomethingElse}"
           propagation="end">
           <h:outputText value="Do Something else (End conversation)" />
           </s:link>
          
           <s:link action="#{serviceManagementBean.doSomething}">
           <h:outputText value="Do Something" />
           </s:link>
          
          


          When invoking "Do Something else..." the conversation is ended (and I return to same xhtml page). When I then execute "Do Something" it executes even though one would expect the Conversational to prevent if from executing and to force it to the ifNotBegunOutcome page.

          Snippet from the log file:
          17:40:02,043 INFO [ServiceManagementBean] doSomethingElse. Ends conversation
          .
          .
          17:40:18,414 INFO [ServiceManagementBean] doSomething
          


          It might be a bug or possibly something in my environment preventing the Conversational to do its job. Comments ?

          Regards

          L

          • 2. Re: @Conversational with s:link
            Mirko Adari Novice

            Havin' the same issue.

            • 3. Re: @Conversational with s:link
              Gavin King Master

              If you're still seeing this problem, please submit your test app to JIRA. TIA.

              • 4. Re: @Conversational with s:link
                Louis Coetzee Apprentice

                Hi Gavin,

                I have created an issue. See

                http://jira.jboss.com/jira/browse/JBSEAM-206

                Thanks

                Louis

                • 5. Re: @Conversational with s:link
                  Gavin King Master

                  This is fixed in CVS. Please test it.

                  • 6. Re: @Conversational with s:link
                    Louis Coetzee Apprentice

                    Thanks Gavin. The fix did the trick ! Much appreciated.

                    One more question... does the Conversational create a faces error message to display to the user why he/she got redirected ? I know that you added this functionality earlier (which worked), but at this point I don't see the message (although in the log file I can see an INFO message (but not an error/info message to display on the view)):


                    INFO [ConversationInterceptor] no long-running conversation for @Conversational bean: viewBean
                    


                    As an aside: this exception still pops up (directly after the above INFO message):





                    ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
                    java.lang.IllegalStateException: No active application scope
                     at org.jboss.seam.core.Init.instance(Init.java:86)
                     at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:156)
                     at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.afterPhase(SeamExtendedManagedPersistencePhaseListener.java:53)
                     at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
                     at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
                     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                     at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                     at java.lang.Thread.run(Thread.java:595)
                    19:21:51,671 INFO [ViewBean] Removed
                    


                    Thanks again for this quick fix !

                    Regards

                    Louis


                    • 7. Re: @Conversational with s:link
                      Louis Coetzee Apprentice

                      Regarding my comment about the Conversational error message:


                      One more question... does the Conversational create a faces error message to display to the user why he/she got redirected ? I know that you added this functionality earlier (which worked), but at this point I don't see the message (although in the log file I can see an INFO message (but not an error/info message to display on the view)):



                      I see that you do create such an error message in ConversationInterceptor.java:

                      log.info("no long-running conversation for @Conversational bean: " + component.getName());
                       FacesMessages.instance().addFromResourceBundle( FacesMessage.SEVERITY_WARN, "org.jboss.seam.NoConversation", "No conversation" );
                      


                      I will try and see why I am not seeing that message.

                      L