1 2 Previous Next 18 Replies Latest reply on Dec 14, 2006 4:10 PM by Chris Lowe

    si:selectItem error parsing

    Chris Lowe Apprentice

      (Not sure I should be posting here for si:selectItem)

      I just tried to download selectitems-1.1.1beta2.jar but I get the following exception when my page renders:

      java.lang.IllegalArgumentException: value must be iteratable
       at org.jboss.seam.selectitems.ui.UISeamSelectItems.createSelectItems(UISeamSelectItems.java:223)
       at org.jboss.seam.selectitems.ui.UISeamSelectItems.getValue(UISeamSelectItems.java:204)
       at org.apache.myfaces.trinidadinternal.renderkit.uix.SelectItemSupport.addSelectItems(SelectItemSupport.java:270)
       at org.apache.myfaces.trinidadinternal.renderkit.uix.SelectItemSupport.getSelectItems(SelectItemSupport.java:90)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer.encodeAllAsElement(SimpleSelectOneRenderer.java:255)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:66)
       at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:294)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.renderFieldCellContents(InputLabelAndMessageRenderer.java:139)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer._renderFieldCell(LabelAndMessageRenderer.java:367)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer.encodeAll(LabelAndMessageRenderer.java:263)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:117)
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:181)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:673)
       at org.apache.myfaces.trinidad.render.RenderUtils.encodeRecursive(RenderUtils.java:67)
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:255)
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:277)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:70)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:134)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:150)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:76)
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:181)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:673)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
       at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:178)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:326)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:290)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:213)
       at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:90)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:619)


      I got @SelectItems working okay with a regular <f:selectItems>. I'm using this with Seam 1.1 CR2, Facelets 1.1.11 and Trinidad components.

      <tr:selectOneChoice value="#{orderStorageBean.mediaHardDisk}">
       <si:selectItems value="#{hardDisks}" var="hd" label="#{hd.name}" />
       <si:convertEntity entityClass="com.ripuk.model.MediaHardDisk" />
      </tr:selectOneChoice>


      Have I done something wrong or is this an incompatibility with Trinidad components?

      Cheers,

      Chris.

        • 1. Re: si:selectItem error parsing
          Chris Lowe Apprentice

          Sorry - got the title wrong!

          • 2. Re: si:selectItem error parsing
            Pete Muir Master

            Sorry for the late reply.

            I've put up a new version in which throws a more descriptive exception. Can you try it and if you are still stuck post the exception here?

            http://wiki.jboss.org/wiki/attach?page=SeamSelectItemsNewDesign%2Fselectitems-1.1.1beta3.zip

            It works well with Trinidad for me :)

            • 3. Re: si:selectItem error parsing
              Chris Lowe Apprentice

              Thanks for looking at this Pete - much appreciated.

              I won't be able to look at this until this evening so I'll let you know how I get on...

              Cheers,

              Chris.

              • 4. Re: si:selectItem error parsing
                Chris Lowe Apprentice

                Hi Pete,

                I'm getting this exception:

                SEVERE: Error Rendering View[/view/public/order-storage.xhtml]
                java.lang.IllegalArgumentException: selectItems' value="#{hardDisks}" must implement java.lang.Iteratable but it is org.jboss.seam.jsf.ListDataModel@1715c20 (class org.jboss.seam.jsf.ListDataModel)
                 at org.jboss.seam.selectitems.ui.UISeamSelectItems.createSelectItems(UISeamSelectItems.java:225)
                 at org.jboss.seam.selectitems.ui.UISeamSelectItems.getValue(UISeamSelectItems.java:204)
                 at org.apache.myfaces.trinidadinternal.renderkit.uix.SelectItemSupport.addSelectItems(SelectItemSupport.java:270)
                 at org.apache.myfaces.trinidadinternal.renderkit.uix.SelectItemSupport.getSelectItems(SelectItemSupport.java:90)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer.encodeAllAsElement(SimpleSelectOneRenderer.java:255)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:66)
                 at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:294)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.renderFieldCellContents(InputLabelAndMessageRenderer.java:139)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer._renderFieldCell(LabelAndMessageRenderer.java:367)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer.encodeAll(LabelAndMessageRenderer.java:263)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:117)
                 at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:181)
                 at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:673)
                 at org.apache.myfaces.trinidad.render.RenderUtils.encodeRecursive(RenderUtils.java:67)
                 at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:255)
                 at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:277)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:70)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:134)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:150)
                 at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:76)
                 at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:181)
                 at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:673)
                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
                 at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:178)
                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:326)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:290)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:213)
                 at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:90)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:619)



                Facelets:

                <tr:selectOneChoice value="#{orderStorageBean.mediaHardDisk}">
                <si:selectItems value="#{hardDisks}" var="hd" label="#{hd.name}" />
                <si:convertEntity entityClass="com.ripuk.model.MediaHardDisk" />
                </tr:selectOneChoice>



                EJB

                @Name("orderStorageBean")
                @Stateful
                public class OrderStorageBeanHome implements OrderStorageBean, Serializable {
                
                 @SuppressWarnings("unused") //seam handled outjection
                 @DataModel
                 private List<MediaHardDisk> hardDisks;
                
                ...
                }



                Any pointers on what this might be?

                Thanks for your help so far,

                Chris.

                • 5. Re: si:selectItem error parsing
                  Pete Muir Master

                  For now outject using @Out not @DataModel. I'll make the next version DataModel aware.

                  • 6. Re: si:selectItem error parsing
                    Kristoffer Carnmarker Newbie

                    Pete,

                    I'm getting the same error here, using you latest build (linked from this thread). However, I'm using an Enum.

                    Error is:

                    java.lang.IllegalArgumentException: selectItems' value="#{companyTypes}" must implement java.lang.Iteratable but it is null (null)
                     at org.jboss.seam.selectitems.ui.UISeamSelectItems.createSelectItems(UISeamSelectItems.java:225)
                     at org.jboss.seam.selectitems.ui.UISeamSelectItems.getValue(UISeamSelectItems.java:204)
                     at org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:102)
                     at org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:477)
                    


                    <h:selectOneRadio value="#{companyRegistration.companyType}"
                     required="true" valueChangeListener="onCompTypeChanged()" tabindex="3">
                     <si:selectItems value="#{companyTypes}" var="companyType" label="#{messages[companyType.labelKey]}"
                     noSelectionLabel="#{messages['label_selectOne']}" cache="false"/>
                    </h:selectOneRadio>
                    


                    public enum CompanyType {
                     MAIN("Main"),
                     BRANCH("Branch");
                    
                     private final String name;
                     private final String labelKey;
                    
                     private CompanyType(String name) {
                     this.name = name;
                     labelKey = "label_companyType_" + name;
                     }
                    
                     public String getLabelKey() {
                     return labelKey;
                     }
                    
                     public String getName() {
                     return name;
                     }
                    
                     public String toString() {
                     return name;
                     }
                    }
                    


                    I just followed you wiki article and looked at the examples. Any idea what's wrong?

                    /Kris

                    • 7. Re: si:selectItem error parsing
                      Pete Muir Master

                      The clue is in the exception message. The el expression #{companyTypes} is resolving to null. To double check you can just write that to the page - e.g.

                      <h:outputText value="#{companyTypes}" />


                      Probably you've got something wrong with the bean that is outjecting it...

                      • 8. Re: si:selectItem error parsing
                        Kristoffer Carnmarker Newbie

                        Hi Pete,

                        Sorry, I forgot to add that code to my OP. As far as I can see, this is just as you do in your examples. I tried adding an @Out as well, but the same thing happens.

                         @Factory("companyTypes")
                         public List<CompanyType> buildCompanyTypes() {
                         CompanyType[] companyTypes = CompanyType.values();
                         return Arrays.asList(companyTypes);
                         }
                        


                        • 9. Re: si:selectItem error parsing
                          Kristoffer Carnmarker Newbie

                          Oh, forgot something else. When I debug that method, the array as well as the List is populated (not null). Also, for some reason, it is called six times!

                          • 10. Re: si:selectItem error parsing
                            Pete Muir Master

                            Is the variable #{companyTypes} not null in other JSF components (h:outputText, ui:repeat for example)?

                            • 11. Re: si:selectItem error parsing
                              Kristoffer Carnmarker Newbie

                              Well, nope, it was not.

                              This problem obviously stems from an apparent lack of understanding of the @Factory annotation. I looked at your examples and saw your factory methods not being accompanied by a property, but instead just returning the created lists. So I thought "well, that's cool, I don't need a property for this List". Alas, it did not work. Adding a "List companyTypes" property with an @Out annotation solved the problem.

                              Anybody care to educate me in why your example code doesn't need to do so?

                              /Kris

                              • 12. Re: si:selectItem error parsing
                                Pete Muir Master

                                What version of Seam are you using?

                                • 13. Re: si:selectItem error parsing
                                  Kristoffer Carnmarker Newbie

                                  I'm using 1.0.1GA

                                  • 14. Re: si:selectItem error parsing
                                    Pete Muir Master

                                    The @Factory style outjection was introduced in 1.1 series (before it just had a void outcome).

                                    1 2 Previous Next