7 Replies Latest reply on Jun 8, 2007 1:06 PM by Andy Gibson

    Conversation id is already in use?

    Andy Gibson Novice

      Hey all,

      I keep getting this error message at various times as I navigate through my test bookstore app. Usually it appears when I change conversations on the switcher, but also during pageflow navigation. I'm using seam 1.2.1GA on JBoss 4.05

      In pages.xml I define :

       <conversation name="bookConv" parameter-name="bookId"
       parameter-value="#{book.id}" />
      
      
       <page view-id="/bookEdit.xhtml" conversation="bookConv">
       <begin-conversation join="true" flush-mode="manual" pageflow="bookEditFlow"/>
       <description>Book Edit #{book.title}</description>
       </page>
      
      


      This is the only conversation config (I am not using @Begin methods).

      My understanding was this this is the (new?) correct way to define business conversation Ids and parameter names, with the idea being that if you tried to edit the same book twice, the conversation param name and value would match an existing conversation and pick that up instead? So rather than start editing the book from scratch, it would just pick up on the existing conversation (which BTW is awesome).

      I don't know whether the problem is that I use bookId as a request parameter when initially editing the book. I pass bookId manually based on whichever book you want to edit. My book instance is obtained from a @factory based on the value in the bookId @RequestParameter. I don't know whether this is right or wrong, but I wanted to try RESTful urls. In essence, this works in that it gets the book from the bookId, and outjects it.

      My links to edit the book (from the book search page) look like :

      <s:link view="/bookEdit.xhtml" value="#{vbook.title}" propagation="nested">
       <f:param name="bookId" value="#{vbook.id}" />
      </s:link>
      


      I use a nested propagation on the link because I want the editing to take place in a nested conversation from the book search page.

      The other part of the puzzle is from my top menu (I use the one from the default seam app) I have my home link as :

      <s:link view="/home.xhtml" value="Home" propagation="none"/>
      


      The error seems to happen most when I go back home using this link and then try and switch to another conversation, but not always.
      When I get the problem as part of a pageflow, I get it when I am returning to the bookEdit.xhtml view after selecting an author.





        • 1. Re: Conversation id is already in use?
          Andy Gibson Novice

          D'oh, yeah, I know that should be :

          propagation="nest"
          


          That seems to get rid of the original problem, but introduces other problems that I'll have to go investigate.









          • 2. Re: Conversation id is already in use?
            Andy Gibson Novice

            Ok, now I think I know what the problem is (but not the answer).

            <conversation name="bookConv" parameter-name="bookId" parameter-value="#{book.id}" />
            


            This xml lets seam detect an existing conversation for the same entity, and switches to it instead of creating a new one. It works fine when starting a new conversation (i.e. editing a book from the search list).

            However, in most cases, it throws a conversation id is in use error.

            I have a search page which lists books. Books are edited from the list by clicking a link with the bookId as a param. Editing books is done within a bookEdit pageflow, and involves one other page where you can pick an author from the list. Upon selection, the pageflow takes you back to the bookEdit page.

            Here's a list of where and when the explicit conversation Id stuff works and raises the conversation Id in use exception.

            bookSearch -> click edit link (try and start new conversation) -> ok
            bookSearch -> Conv Switcher -> exception
            bookEdit -> Conv Switcher -> ok
            author Select -> select author (pageflow navigation)-> exception
            author select -> Conv Switcher -> exception

            If I remove the xml from pages.xml, everything works fine, except that I can start editing two instances of the same book at the same time which is what avoids.

            As far as I can tell, the stuff is fairly new (currently undocumented in 1.2.1GA) and isn't used in any of the examples. With the possible deprecation of @begin annotations on methods in favour of this mechanism, I'm guessing this is the new Seam way.

            Anyone have any experience with this mechanism and gotten it working with conversation switchers and pageflow?



            • 3. Re: Conversation id is already in use?
              Andy Gibson Novice

              Sorry, should clarify that :

              according to http://jira.jboss.com/jira/browse/JBSEAM-976, the id="" portion of the @Begin annotation is possibly being deprecated in favour of natural conversation Ids in the pages.xml, not the whole @Begin annotation.



              • 4. Re: Conversation id is already in use?
                Gavin King Master

                Please create a very simple project that reproduces the problem, and add an issue to JIRA so we can take a look.

                • 5. Re: Conversation id is already in use?
                  Andy Gibson Novice

                  I have stripped down my seam-gen generated bookstore test app to the minimum, and created an import sql script and written some test cases to demonstrate the problem.

                  Do you want me to include all 30meg (zipped) of jars also, or should I just delete them from the zip file? There's nothing additional in there, I just created it from a plain old seam-gen app.

                  Zipped, the app comes to 31meg, without the jars its 64kb. I just didn't want to go drive people crazy by posting 30 meg attachements into the JIRA.

                  • 6. Re: Conversation id is already in use?
                    Gavin King Master

                    Attach the whole thing if it fits. I might have diff jar versions.

                    • 7. Re: Conversation id is already in use?
                      Andy Gibson Novice

                      Ok, all done :

                      http://jira.jboss.org/jira/browse/JBSEAM-1423

                      I had to attach it in 4 parts, all zipped. I've included test cases that demonstrates the problem.

                      In the test app (a cut down version of my dummy book store app) there is no exception on the page flow navigation page changes, only on using the conversation switcher to change conversations.