Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2243

Conversation does not start after call to begin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Minor
    • Unscheduled
    • None
    • Conversations
    • None
    • Hide

      Write a servlet called StartConversationServlet that injects a CDI Conversation object, and that calls conversation.begin() in #doGet, then shows the id of the just created conversation.

      Write another servlet called ViewConversationServlet that injects a ConversationScoped object and that prints out conversation.getId() in #doGet (and does something with the injected ConversationScoped object).

      Deploy the two servlets and the ConversationScoped object in a war.

      Query the StartConversationServlet first. Several times. It always tells you that it has created a conversation with id 1. (Expected: a conversion with a different id on every call.) Relatedly, when you query ViewConversationServlet with ?cid=1, weld tells you:

      org.jboss.weld.context.NonexistentConversationException: WELD-000321: No conversation found to restore for id 1

      . (Expected: the conversation exists.)

      Query ViewConversationServlet with no ?cid parameter. Then everything starts to work as it should. Expectedly, ViewConversationServlet tells you that the current conversation id is “null”. Then, querying StartConversationServlet expectedly starts a conversation with id 1, then 2, and so on. Now, querying ViewConversationServlet with ?cid=1 does not fail any more.

      The same happens when setting a timeout to 10_000 milliseconds in StartConversationServlet for the conversation.

      The sample code is in GitHub.

      Show
      Write a servlet called StartConversationServlet that injects a CDI Conversation object, and that calls conversation.begin() in #doGet, then shows the id of the just created conversation. Write another servlet called ViewConversationServlet that injects a ConversationScoped object and that prints out conversation.getId() in #doGet (and does something with the injected ConversationScoped object). Deploy the two servlets and the ConversationScoped object in a war. Query the StartConversationServlet first. Several times. It always tells you that it has created a conversation with id 1. (Expected: a conversion with a different id on every call.) Relatedly, when you query ViewConversationServlet with ?cid=1, weld tells you: org.jboss.weld.context.NonexistentConversationException: WELD-000321: No conversation found to restore for id 1 . (Expected: the conversation exists.) Query ViewConversationServlet with no ?cid parameter. Then everything starts to work as it should. Expectedly, ViewConversationServlet tells you that the current conversation id is “null”. Then, querying StartConversationServlet expectedly starts a conversation with id 1, then 2, and so on. Now, querying ViewConversationServlet with ?cid=1 does not fail any more. The same happens when setting a timeout to 10_000 milliseconds in StartConversationServlet for the conversation. The sample code is in GitHub .

    Description

      It seems like Weld refuses to start conversations as long as it has not seen any attempt of using it yet.

      I suspect this might be related to https://issues.jboss.org/browse/WELD-1559.

      Attachments

        Activity

          People

            Unassigned Unassigned
            oliviercailloux Olivier Cailloux (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: