4 Replies Latest reply on Aug 13, 2008 8:44 AM by Luc Feys

    All actions executed twice

    Luc Feys Newbie

      Hello,


      I have posted about this problem before, but I have new information available on it and I am hoping at some point someone will be able to give me a clue on this one.


      I am using seam 1.2.1 on JBoss 4.0.5.


      All the actions in my application are executed twice, whether I call them using an h:commandButton, an s:button, an s:link, ...


      I have added a phaseTracker to retrieve some information about the request, and I actually see the whole request cycle being execute twice.


      Below is the log trace of a post with validation errors.


      12:31:34,453 INFO  [STDOUT] BEFORE RESTORE_VIEW(1)
      12:31:34,546 INFO  [STDOUT] AFTER RESTORE_VIEW(1): en
      12:31:34,562 INFO  [STDOUT] BEFORE APPLY_REQUEST_VALUES(2): en
      12:31:34,578 WARN  [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl] Unsupported component-family/renderer-type: org.jboss.seam.ui.Forma
      ttedText/javax.faces.Text
      12:31:34,578 WARN  [javax.faces.component.UIComponentBase] No Renderer found for component {Component-Path : [Class: javax.faces.component.U
      IViewRoot,ViewId: /app/home.xhtml][Class: javax.faces.component.html.HtmlForm,Id: searchform][Class: be.belgacom.my1x07.front.web.facelets.U
      IFormattedText,Id: _id59]} (component-family=org.jboss.seam.ui.FormattedText, renderer-type=javax.faces.Text)
      12:31:34,578 INFO  [STDOUT] AFTER APPLY_REQUEST_VALUES(2): en
      12:31:34,578 INFO  [STDOUT] BEFORE PROCESS_VALIDATIONS(3): en
      12:31:34,578 INFO  [STDOUT] AFTER PROCESS_VALIDATIONS(3): en
      12:31:34,593 INFO  [STDOUT] MessageListener - Before RENDER_RESPONSE(6)
      12:31:34,593 INFO  [STDOUT] MessageListener - Locale: en
      12:31:34,593 INFO  [STDOUT] MessageListener - Processing searchform:nameOrActivity
      12:31:34,593 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=SearchformByName
      ;
      12:31:34,593 INFO  [STDOUT] MessageListener - FieldRef found for searchform:nameOrActivity
      12:31:34,593 INFO  [STDOUT] MessageListener - Message found for searchform:nameOrActivity: mandatory
      12:31:34,593 INFO  [STDOUT] Creating new contentManager
      12:31:34,609 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.NuxeoManager] Searching nuxeo: SELECT * FROM ErrorMessages
      12:31:34,640 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.NuxeoManager] Results found: 1
      12:31:34,656 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Stored item in cache: type=ErrorMessages;
      12:31:34,765 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Stored item in cache for locale en: type=ErrorMessages;
      12:31:34,765 INFO  [STDOUT] MessageListener - MessageText: Please specify a value for '{0}'
      12:31:34,765 INFO  [STDOUT] MessageListener - Processing searchform:city
      12:31:34,765 INFO  [STDOUT] MessageListener - FieldRef found for searchform:city
      12:31:34,765 INFO  [STDOUT] MessageListener - Message found for searchform:city: mandatory
      12:31:34,765 INFO  [STDOUT] MessageListener - MessageText: Please specify a value for '{0}'
      12:31:34,765 INFO  [STDOUT] BEFORE RENDER_RESPONSE(6): en
      ...
      12:31:34,812 WARN  [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl] Unsupported component-family/renderer-type: org.jboss.seam.ui.Forma
      ttedText/javax.faces.Text
      12:31:34,812 WARN  [javax.faces.component.UIComponentBase] No Renderer found for component {Component-Path : [Class: javax.faces.component.U
      IViewRoot,ViewId: /app/home.xhtml][Class: javax.faces.component.html.HtmlForm,Id: searchform][Class: be.belgacom.my1x07.front.web.facelets.U
      IFormattedText,Id: _id59]} (component-family=org.jboss.seam.ui.FormattedText, renderer-type=javax.faces.Text)
      12:31:34,812 WARN  [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl] Unsupported component-family/renderer-type: org.jboss.seam.ui.Forma
      ttedText/javax.faces.Text
      12:31:34,812 WARN  [javax.faces.component.UIComponentBase] No Renderer found for component {Component-Path : [Class: javax.faces.component.U
      IViewRoot,ViewId: /app/home.xhtml][Class: javax.faces.component.html.HtmlForm,Id: searchform][Class: be.belgacom.my1x07.front.web.facelets.U
      IFormattedText,Id: _id59]} (component-family=org.jboss.seam.ui.FormattedText, renderer-type=javax.faces.Text)
      12:31:34,812 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=PopularSearchBox
      ;
      12:31:34,828 INFO  [STDOUT] AFTER RENDER_RESPONSE(6): en
      12:31:34,968 INFO  [STDOUT] BEFORE RESTORE_VIEW(1)
      12:31:34,968 INFO  [STDOUT] AFTER RESTORE_VIEW(1): nl
      12:31:34,968 INFO  [STDOUT] MessageListener - Before RENDER_RESPONSE(6)
      12:31:34,968 INFO  [STDOUT] MessageListener - Locale: nl
      12:31:34,968 INFO  [STDOUT] BEFORE RENDER_RESPONSE(6): nl
      12:31:35,000 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=PopularSearchIte
      m;
      12:31:35,046 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=SearchformByName
      ;
      12:31:35,046 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=SearchformByPhon
      e;
      12:31:35,046 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=SearchformByGoog
      le;
      12:31:35,093 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=SearchformCommon
      ;
      12:31:35,109 WARN  [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl] Unsupported component-family/renderer-type: org.jboss.seam.ui.Forma
      ttedText/javax.faces.Text
      12:31:35,109 WARN  [javax.faces.component.UIComponentBase] No Renderer found for component {Component-Path : [Class: javax.faces.component.U
      IViewRoot,ViewId: /app/home.xhtml][Class: javax.faces.component.html.HtmlForm,Id: searchform][Class: be.belgacom.my1x07.front.web.facelets.U
      IFormattedText,Id: _id59]} (component-family=org.jboss.seam.ui.FormattedText, renderer-type=javax.faces.Text)
      12:31:35,109 WARN  [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl] Unsupported component-family/renderer-type: org.jboss.seam.ui.Forma
      ttedText/javax.faces.Text
      12:31:35,109 WARN  [javax.faces.component.UIComponentBase] No Renderer found for component {Component-Path : [Class: javax.faces.component.U
      IViewRoot,ViewId: /app/home.xhtml][Class: javax.faces.component.html.HtmlForm,Id: searchform][Class: be.belgacom.my1x07.front.web.facelets.U
      IFormattedText,Id: _id59]} (component-family=org.jboss.seam.ui.FormattedText, renderer-type=javax.faces.Text)
      12:31:35,109 DEBUG [be.belgacom.my1x07.front.business.manager.nuxeo.ContentManager] Item found in cache for locale nl: type=PopularSearchBox
      ;
      12:31:35,140 INFO  [STDOUT] AFTER RENDER_RESPONSE(6): nl



      Now there are some weird things:



      • The JSF lifecycle is execute twice. See the messages from my phaseTracker (implements PhaseListener) 'AFTER...' and 'BEFORE...'

      • The current locale (which should be 'nl') is not the same for both cycles. I've added the current locale in the log messages of the PhaseTracker. To retrieve the locale in the PhaseListener, I use facesContext.viewRoot.getLocale.

      • The MessageListener (see messages preceded with 'MessageListener - ' doesn't find the same information in the second cycle: no values are returned from 'facesContext.getClientIdsWithMessages', so it's seems like no validation errors have occured in the second cycle.



      If anyone could shed a light on this or help me in finding out more about this problem, I would be very grateful.


      Cheers.


      Luc Feys

        • 1. Re: All actions executed twice
          Luc Feys Newbie

          Hello,


          finally I've been able to find out what was wrong.
          While all the time I was thinking something was wrong with my seam configuration (some phaselistener called twice or some library initialized twice), it was much simpler than that.
          My .seam actions were called twice by the browser: once by the initial request, a second time to retrieve an image that had an empty url, which caused a reload of the same page that was initially called. And since that image was located in the header of my page, I had the same problem on all my pages.


          Phew, I'm glad this on's resolved. Costed me quite a few hours.


          Cheers.


          Luc

          • 2. Re: All actions executed twice
            Tony Mai Apprentice

            Luc Feys wrote on May 13, 2008 21:23:


            a second time to retrieve an image that had an empty url, which caused a reload of the same page that was initially called. And since that image was located in the header of my page, I had the same problem on all my pages.



            Can you elaborate on what you meant by an image that had an empty url?


            I too have this problem with actions executed twice. I have several images on the page, all do not have any URL associated with the images (aka no

            url="..."

            ever specified). For example, I have the following codes:



            <h:commandLink action="#{wcFileMenu.gotoWcHome}" title="#{messages['hdr.compLogo.title']}" >
                 <h:graphicImage value="/img/client_hdr_logo.gif" width="41" height="40" alt="#{messages['hdr.compLogo.title']}" border="0" />
            </h:commandLink>



            which rendered the following HTML


            <a href="#" title="Judo Systems" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['j_id6'],'j_id6:j_id9,j_id6:j_id9','');}return false"><img src="/trading/img/client_hdr_logo.gif" alt="Judo Systems" border="0" height="40" width="41" /></a></td><td class="dr-toolbar-int rich-toolbar-item ">
            



            Also, I use RichFaces's


            <rich:spacer height="10" />



            which renders the following HTML


            <img class="rich-spacer " height="2" id="j_id6:j_id33" src="/trading/a4j_3_2_0-SNAPSHOTimages/spacer.gif" width="1" />



            This page seems to be called twice. Could it be a problem with my image?


            Thanks for your help.


            -tony

            • 3. Re: All actions executed twice
              Luc Feys Newbie

              Hello Tony,


              with an empty url I meant an empty src attribute. The image in the final html page was


              When the browser tried to retrieve the image, it just called my page again.


              Hope this helps.


              Luc

              • 4. Re: All actions executed twice
                Luc Feys Newbie

                Hi Tony,


                I meant to include an example of my image tag, but failed to save it (man I hate this editor :-()



                <img src='' alt='my alt text' ... />



                Cheers.


                Luc