6 Replies Latest reply on Aug 7, 2007 4:31 PM by mgrouch

    Seam conversations and third party JSF components libs

      What is the way to send conversation id with third-party libraries ajax requests. For example, Quipukit library comes with data table
      pagination control which has ajaxed controls. Click on those controls
      submits ajax request without conversation id and causes exception on
      server side

      java.lang.IllegalStateException: No active conversation context
      at org.jboss.seam.core.Conversation.instance(Conversation.java:103)
      at org.jboss.seam.faces.FacesManager.prepareBackswitch(FacesManager.java:236)
      at org.jboss.seam.jsf.SeamPhaseListener.afterRender(SeamPhaseListener.java:505)
      at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
      at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)


      Is there workaround for it?
      Thanks

        • 1. Re: Seam conversations and third party JSF components libs

          I've made some progress with this issue by adding
          page action

          action="#{myBean.beginCall}"


          <page xmlns="http://jboss.com/products/seam/pages"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
           login-required="true"
           conversation-required="false"
           no-conversation-view-id="/home.xhtml"
           action="#{myBean.beginCall}">
           <!--
           <begin-conversation join="true"/>
           -->
          </page>



          and action in myBean

          public String beginCall() {
           Lifecycle.beginCall();
           return null;
           }



          java.lang.IllegalStateException: No active conversation context
          now fixed and disappeared, requests are processed with correct response being rendered. However there are too many exceptions in the log.

          java.lang.IllegalStateException: No phase id bound to current thread
          at org.jboss.seam.contexts.PageContext.getPhaseId(PageContext.java:162)

          Is this even the right approach?
          Thanks




          • 2. Re: Seam conversations and third party JSF components libs

            I've got rid of some exceptions by improving beginCall()

             if (!Contexts.isConversationContextActive()) {
             Lifecycle.beginCall();
             }
             if (!Contexts.isPageContextActive()) {
             FacesLifecycle.resumePage();
             }
             try {
             if (!Transaction.instance().isActiveOrMarkedRollback()) {
             Transaction.instance().begin();
             }
             }
             catch (Exception ex) {
             throw new IllegalStateException("Could not start transaction", ex);
             }


            I still have this exception which I haven't figured out how to get rid of:

            java.lang.IllegalStateException: Could not commit transaction
            at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:589)
            at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
            at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
            at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
            at teamdev.jsf.util.g.b(SourceFile:87)
            at teamdev.jsf.util.AjaxRequestsPhaseListener.a(SourceFile:694)
            at teamdev.jsf.util.AjaxRequestsPhaseListener.a(SourceFile:546)
            at teamdev.jsf.util.AjaxRequestsPhaseListener.a(SourceFile:413)
            at teamdev.jsf.util.AjaxRequestsPhaseListener.b(SourceFile:404)
            at teamdev.jsf.util.AjaxRequestsPhaseListener.g(SourceFile:289)
            at teamdev.jsf.util.AjaxRequestsPhaseListener.afterPhase(SourceFile:194)
            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
            at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            ...

            Caused by: java.util.EmptyStackException
            at java.util.Stack.peek(Stack.java:79)
            at org.jboss.seam.transaction.Transaction.beforeCommit(Transaction.java:64)
            at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:44)
            at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:579)


            • 3. Re: Seam conversations and third party JSF components libs
              pmuir

              Take a look org.jboss.seam.ui.resource.StyleResource.getResource() for how to properly run your code inside the Seam lifecycle.

              • 4. Re: Seam conversations and third party JSF components libs

                Hmm. Looking at that doesn't help me (or I do not undersand something).
                I think now I can explain my problem better.

                When quipukit submits its own ajax requests (like during the click on pagination control) all Seam contexts are not available on server side.
                What would be a workaround to fix it? I do not have the source of quipukit
                as it is proprietary and it works with Seam 1.2.1.GA. The problem is only with Seam 2.0.Beta1.

                Thanks

                • 5. Re: Seam conversations and third party JSF components libs

                  I appreciate any ideas. I'm stuck with this problem.
                  Thanks

                  • 6. Re: Seam conversations and third party JSF components libs

                    Still no luck trying to resolve this. Any help is very much appreciated.
                    Thanks