1 2 Previous Next 16 Replies Latest reply on Feb 23, 2009 12:34 PM by Nick Belaevski

    WARNING: FacesMessage(s) have been enqueued

    Waqas Arshad Novice

      I am updating selectOneMenu using ajax. It is updating properly but on page submit i get the following message:

      WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=r_mgmt_form:eq_code1[severity=(ERROR 2), summary=(r_mgmt_form:eq_code1: Validation Error: Value is not valid), detail=(r_mgmt_form:eq_code1: Validation Error: Value is not valid)]

      Any suggestions?

        • 1. Re: WARNING: FacesMessage(s) have been enqueued
          Waqas Arshad Novice

          can someone help me out...???

          • 3. Re: WARNING: FacesMessage(s) have been enqueued
            Waqas Arshad Novice

            Sorry i didn't get it exactly. Can you explain a bit. It will be very kind if you give a small example

            • 4. Re: WARNING: FacesMessage(s) have been enqueued
              Nick Belaevski Master

              That means that you have broken component and model synchronization.
              Select items set should be the same when component is rendered and when its submission is processed on subsequent request (sort of security protection). Most probably, your code doesn't behave well in this point.

              • 5. Re: WARNING: FacesMessage(s) have been enqueued
                Waqas Arshad Novice

                e.g if at the time of page load the list is populated as:

                eq_code_list = new ArrayList<SelectItem>();
                eq_code_list.add(new SelectItem(""));
                


                and when an ajax call is made it is updated as:

                eq_code_list.add(new SelectItem("MY NEW DATA 2"));
                


                Is it the problem???
                THanks

                • 7. Re: WARNING: FacesMessage(s) have been enqueued
                  Waqas Arshad Novice

                  okay, so do i need to create a fresh object

                  eq_code_list = new ArrayList()

                  when ajax call is made?
                  Sorry for asking such a weird questions, as i m new to this.


                  • 9. Re: WARNING: FacesMessage(s) have been enqueued
                    Nick Belaevski Master

                    You should support such list state so that it has exactly the same items when it's rendered and when component is submitted back to server.

                    • 10. Re: WARNING: FacesMessage(s) have been enqueued
                      Waqas Arshad Novice

                      Thanks for the reply.
                      Still got little bit confusion. By state you mean that it should have the same items during render and submit?
                      e.g if at the time of page load

                      eq_code_list = new ArrayList<SelectItem>();
                      eq_code_list.add(new SelectItem("ABC"));
                      eq_code_list.add(new SelectItem("XYZ"));
                      


                      then at the time of submit, it should have the same.
                      eq_code_list = new ArrayList<SelectItem>();
                      eq_code_list.add(new SelectItem("ABC"));
                      eq_code_list.add(new SelectItem("XYZ"));
                      


                      if so, then how can we implement ajax as it changes the items on certain event.

                      • 11. Re: WARNING: FacesMessage(s) have been enqueued
                        Nick Belaevski Master

                         

                        <h:form>
                         <rich:messages />
                        
                         <h:selectManyCheckbox value="#{forum5Bean.valueOptions}">
                         <f:selectItems value="#{forum5Bean.initialOptions}"/>
                        
                         <a4j:support event="onclick" reRender="day" action="#{forum5Bean.apply}"/>
                         </h:selectManyCheckbox>
                        
                         <h:selectOneMenu id="day">
                         <f:selectItems value="#{forum5Bean.options}"/>
                         </h:selectOneMenu>
                        
                         <h:commandButton value="Button" />
                         </h:form>


                        private List<SelectItem> options = new ArrayList<SelectItem>();
                        
                         private List<SelectItem> initialOptions = new ArrayList<SelectItem>(Arrays.asList(new SelectItem("Monday"), new SelectItem("Tuesday"), new SelectItem("Wednesday")));
                        
                         private List<Object> valueOptions = new ArrayList<Object>();
                        
                         public List<SelectItem> getOptions() {
                         return options;
                         }
                        
                         public void setOptions(List<SelectItem> options) {
                         this.options = options;
                         }
                        
                         public List<SelectItem> getInitialOptions() {
                         return initialOptions;
                         }
                        
                         public List<Object> getValueOptions() {
                         return valueOptions;
                         }
                        
                         public void setValueOptions(List<Object> valueOptions) {
                         this.valueOptions = valueOptions;
                         }
                        
                         public void apply() {
                         this.options.clear();
                         for (Object object : valueOptions) {
                         this.options.add(new SelectItem(object));
                         }
                         }


                        • 12. Re: WARNING: FacesMessage(s) have been enqueued
                          Waqas Arshad Novice

                          Sir, thanks for the reply/example. I check it out and run it but got some problem in it. When i double check any check box it throws exception.

                          javax.servlet.ServletException
                           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
                           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
                           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                           at java.lang.Thread.run(Thread.java:595)
                          Caused by: java.util.NoSuchElementException
                           at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:130)
                           at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:157)
                           at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:61)
                           at javax.faces.component.SelectUtils.matchValue(SelectUtils.java:82)
                           at javax.faces.component.UISelectOne.validateValue(UISelectOne.java:144)
                           at javax.faces.component.UIInput.validate(UIInput.java:875)
                           at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
                           at javax.faces.component.UIInput.processValidators(UIInput.java:672)
                           at javax.faces.component.UIForm.processValidators(UIForm.java:235)
                           at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:439)
                           at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
                           at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:455)
                           at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
                           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                           ... 18 more
                          


                          e.g if i check Monday it updates the list with Monday, but if i uncheck Monday or select and other day it throws above exception.

                          • 13. Re: WARNING: FacesMessage(s) have been enqueued
                            Waqas Arshad Novice

                            i am trying to update the h:datatable using ajax call. Datatable is updating but when i click submit it throws an exception

                            
                            javax.faces.el.EvaluationException: java.lang.NullPointerException
                             at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
                             at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                             at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                             at javax.faces.component.UIData.broadcast(UIData.java:938)
                             at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
                             at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
                             at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
                             at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
                             at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                             at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                             at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                             at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                             at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                             at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
                             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
                             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
                             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                             at java.lang.Thread.run(Thread.java:595)
                            Caused by: java.lang.NullPointerException
                             at tsheet.ApproveRegular.ApproveTsheet.showRegDetails(ApproveTsheet.java:223)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                             at java.lang.reflect.Method.invoke(Method.java:585)
                             at org.apache.el.parser.AstValue.invoke(AstValue.java:152)
                             at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                             at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
                             at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                             ... 29 more
                            

                            Is it because of the same reason that values are not same during render and submit?
                            Please help me out to this problem. I am facing this problem at many other places. I don;t know how to keep the values same during these two phases

                            • 14. Re: WARNING: FacesMessage(s) have been enqueued
                              Nick Belaevski Master

                              No, that's because of NPE:

                              Caused by: java.lang.NullPointerException
                              at tsheet.ApproveRegular.ApproveTsheet.showRegDetails(ApproveTsheet.java:223)

                              P.S. You can use eventsQueue attribute to prevent concurrent AJAX requests and NoSuchElementException

                              1 2 Previous Next