Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-3848

Seam fails to create and inject components when multiple ajax-requests are fired from a commandLink or commandButton, using ajax4jsf.

    Details

    • Affects:
      Interactive Demo/Tutorial
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Using scripts disabling all input-submit-buttons and dropdows using ajax one can prohibit users from double-clicking. oncomplete is used to reactivate all buttons again. This is NOT a nice solution.

      Show
      Using scripts disabling all input-submit-buttons and dropdows using ajax one can prohibit users from double-clicking. oncomplete is used to reactivate all buttons again. This is NOT a nice solution.
    • Estimated Difficulty:
      High

      Description

      Seam fails to create and inject components when multiple ajax-requests are fired from a commandLink or commandButton, using ajax4jsf.

      Replication found using seam-booking in examples, trunk as of 081216.
      Rewrite the find-method in the HotelSearchAction-class, in the seam booking example application. It should look like this.

      public void find() {
      page = 0;
      queryHotels();
      try

      { Thread.sleep(1000 * 5); }

      catch (InterruptedException ignore) {
      }
      }

      Now, start the application, register a user and enter main.html. Click multiple times on the search hotel button. Depending upon how fast your computer is, you might need to do more than a double-click. Sometimes you may need to klick fast up to 5-8 times. But it will occur.

      You will end up with an exception that says:
      Caused by javax.servlet.ServletException with message: javax.el.ELException: /main.xhtml @74,130 rendered=#

      {hotelSearch.nextPageAvailable}

      : Error reading nextPageAvailable on type org.javassist.tmp.java.lang.Object_$$_javassist_4

      Which in turn comes from a synchronization problem.
      Caused by org.jboss.seam.core.LockTimeoutException with message: could not acquire lock on @Synchronized component: hotelSearch

      This is in a way funny, since the hotelSearch-component is not annotated with synchronized. Anyway, our application does not throw an exception like this, but we to have tried synchronizing our involved components, with no luck. Our exception is mostly this
      Caused by javax.servlet.ServletException with message: javax.el.ELException: /layout/template.xhtml @18,59 rendered=#

      {authenticator.inSpecialMode}

      : Error reading inSpecialMode on type se.session.Authenticator_$$_javassist_4

      Which in turn comes from the failed injections
      Caused by org.jboss.seam.RequiredException with message: @In attribute requires non-null value: authenticator.entityManager

      This problem occurs all over the application, always when an ajax request is double-clicked and seam tries to recreate seam components and runs out of time. In 99% of the case it is the first read property of our authenticator-component that fails, and most often it is that seam cannot create a entityManager to inject, and the system fails due to that the annotation is set to only inject, without create. Removing the entityManager from the component will only result in that seam cannot inject another component instead, until you have no injections left in authenticator, and it still fails!

      Similar behaviour has been noticed using non-ajax calls, using standard h:commandButton/Link. This is however much more rare.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  manaRH Marek Novotny
                  Reporter:
                  etirk etirk etirk
                • Votes:
                  9 Vote for this issue
                  Watchers:
                  12 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 2 days
                    2d
                    Remaining:
                    Remaining Estimate - 2 days
                    2d
                    Logged:
                    Time Spent - Not Specified
                    Not Specified