7 Replies Latest reply on Oct 19, 2006 1:38 AM by johnurban

    Binding Dropdown To Database Table Using Seam..

    johnurban Newbie
        • 1. Re: Binding Dropdown To Database Table Using Seam..
          johnurban Newbie

          My Code give the "does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null" error message:

          JSF:

           <h:selectOneMenu value="#{roomFinder.example.name}"
           converter="#{roomFinder.roomConverter}">
           <f:selectItems value="#{roomListByOrganization}"/>
           </h:selectOneMenu>
          


          EJB backer for roomListByOrganization

          ...
          
           private Room example = new Room();
          
           public Room getExample() {
           return example;
           }
           @SelectItems(valueStrategy=SelectItems.Strategy.OBJECT, labelMethod="getname")
           private List<Room> roomListByOrganization;
          ...
          
           @Factory("roomListByOrganization")
           public List getRoomListByOrganization() { // f:selectItems value
           Map<String, Object> parameters = new HashMap<String, Object>();
           StringBuffer queryString = new StringBuffer();
           Users loggedInUser = login.getInstance();
          
           queryString.append(" and room.organizationId = :organizationId");
           parameters.put("organizationId", loggedInUser.getOrganizationId());
          
           if (queryString.length() == 0) {
           queryString.append("select room from Room room");
           } else {
           queryString.delete(0, 4).insert(0,
           "select room from Room room where");
           }
          
           if (order != null) {
           queryString.append(" order by room.").append(order);
           if (descending)
           queryString.append(" desc");
           }
          
           Query query = entityManager.createQuery(queryString.toString());
           for (Entry<String, Object> param : parameters.entrySet()) {
           query.setParameter(param.getKey(), param.getValue());
           }
           roomListByOrganization = (List<Room>) query.setMaxResults(pageSize).setFirstResult(
           pageSize * pageNumber).getResultList();
           return roomListByOrganization;
           }
          


          RoomConverter.java

          package testSeam;
          
          import java.io.Serializable;
          import java.util.List;
          
          import javax.faces.component.UIComponent;
          import javax.faces.context.FacesContext;
          import javax.faces.convert.Converter;
          import javax.faces.convert.ConverterException;
          
          public class RoomConverter implements Converter, Serializable {
          
           private static final long serialVersionUID = 3820066884549543875L;
          
           List<Room> roomList;
          
           public RoomConverter(
           List<Room> roomList){
           this.roomList = roomList;
           }
          
           public String getAsString(FacesContext facesContext,
           UIComponent component,
           Object obj) {
          
           if (obj == null) return null;
          
           Room room = (Room) obj;
           String val = String.valueOf(room.getName());
           return val;
           }
          
           public Object getAsObject(FacesContext facesContext,
           UIComponent component,
           String str) throws ConverterException {
          
           if (str == null || str.length()==0) {
           return null;
           }
          
           long id = Long.valueOf(str).longValue();
           for (Room room : roomList){
           if (room.getId() == id) {
           return room;
           }
           }
           return null;
           }
          }
          
          



          15:49:08,373 INFO [STDOUT] Hibernate: select room0_.ID as ID256_, room0_.Name as Name256_, room0_.OrganizationID as Organiza3_256_, room0_.Capacity as Capacity256_ from checkin.room room0_ where room0_.OrganizationID=? limit ?
          15:49:08,381 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
          java.lang.IllegalArgumentException: Value binding '#{roomListByOrganization}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
          at org.apache.myfaces.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:142)
          at org.apache.myfaces.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:485)
          at org.apache.myfaces.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:461)
          at org.apache.myfaces.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:272)
          at org.apache.myfaces.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:246)
          at org.apache.myfaces.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
          at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
          at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
          at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_h_selectOneMenu_0(uQuickPersonAdd_jsp.java:462)
          at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_h_form_0(uQuickPersonAdd_jsp.java:302)
          at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_f_view_0(uQuickPersonAdd_jsp.java:193)
          at org.apache.jsp.uQuickPersonAdd_jsp._jspService(uQuickPersonAdd_jsp.java:101)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
          at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
          at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
          at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
          at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
          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.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:613)
          15:49:08,384 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
          javax.servlet.ServletException: Value binding '#{roomListByOrganization}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
          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.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:613)
          15:49:08,386 INFO [SeamExceptionFilter] killing transaction
          15:49:08,390 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
          javax.faces.FacesException: Value binding '#{roomListByOrganization}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
          at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
          at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
          at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
          at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
          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.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)


          • 2. Re: Binding Dropdown To Database Table Using Seam..
            Christian Bauer Master

            It's not much help, but I definitely agree that the SelectItem stuff is a total nightmare in JSF. There is an open JIRA issue for Seam that tries to unify the various strategies in an easier to use API/annotation. It's not done yet.

            Personally, I really don't understand why the standard SelectItem implementation can't just take another argument in the constructor that uniquely identifies an instance for the toObject() and toString() methods of a default JSF converter, something like:

            selectItemList.add(
            new SelectItem("label", item, item.hashCode())
            );

            • 3. Re: Binding Dropdown To Database Table Using Seam..
              johnurban Newbie

              Thanks for the reply so late.

              So, what are my options for this? Is your:

              selectItemList.add(
              new SelectItem("label", item, item.hashCode())
              );

              an option?

              This is a major piece to the web application puzzle...

              • 4. Re: Binding Dropdown To Database Table Using Seam..
                Jarkko Lietolahti Novice

                It says that your roomListByOrganization is null, which means that public List getRoomListByOrganization() didn't return anything?

                If it's ok to have empty roomListByOrganization you need to initalize it with empty list;
                Like

                @SelectItems(valueStrategy=SelectItems.Strategy.OBJECT, labelMethod="getname")
                 private List<Room> roomListByOrganization = new ArrayList(Room);
                


                I'm using @SelectItems from http://www.jroller.com/page/pmuir?entry=selectitems_revisited with the EntityConverter, and find it working quite nicely. Thou there're couple of bugs (see the end of the blog) in 1.0rc4, but those can be fixed easily.


                • 5. Re: Binding Dropdown To Database Table Using Seam..
                  Denis Karpov Newbie

                  Look at http://wiki.jboss.org/wiki/Wiki.jsp?page=SelectItems
                  I use this pattern. It is quite plain and it correctly works with empty elements.

                  • 6. Re: Binding Dropdown To Database Table Using Seam..
                    johnurban Newbie

                    I was able to get past the null error by putting @Out above my list declaration in the EJB backer bean:

                     @Out
                     @SelectItems(valueStrategy=SelectItems.Strategy.OBJECT, labelMethod="getname")
                     private List<Room> roomListByOrganization;
                    
                    


                    Now I'm getting "does not contain Objects of type SelectItem":


                    08:13:36,906 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
                    java.lang.IllegalArgumentException: Collection referenced by UISelectItems with binding '#{roomListByOrganization}' and Component-Path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not contain Objects of type SelectItem
                    at org.apache.myfaces.util.SelectItemsIterator.next(SelectItemsIterator.java:182)
                    at org.apache.myfaces.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:487)
                    at org.apache.myfaces.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:461)
                    at org.apache.myfaces.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:272)
                    at org.apache.myfaces.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:246)
                    at org.apache.myfaces.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
                    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
                    at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
                    at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
                    at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_h_selectOneMenu_0(uQuickPersonAdd_jsp.java:462)
                    at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_h_form_0(uQuickPersonAdd_jsp.java:302)
                    at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_f_view_0(uQuickPersonAdd_jsp.java:193)
                    at org.apache.jsp.uQuickPersonAdd_jsp._jspService(uQuickPersonAdd_jsp.java:101)
                    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
                    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
                    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
                    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
                    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
                    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
                    at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
                    at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
                    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                    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.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:613)
                    08:13:36,908 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
                    javax.servlet.ServletException: Collection referenced by UISelectItems with binding '#{roomListByOrganization}' and Component-Path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not contain Objects of type SelectItem
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                    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.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:613)
                    08:13:36,909 INFO [SeamExceptionFilter] killing transaction
                    08:13:36,914 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
                    javax.faces.FacesException: Collection referenced by UISelectItems with binding '#{roomListByOrganization}' and Component-Path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not contain Objects of type SelectItem
                    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
                    at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
                    at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
                    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                    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.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:613)
                    Caused by: org.apache.jasper.JasperException: Collection referenced by UISelectItems with binding '#{roomListByOrganization}' and Component-Path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id7][Class: javax.faces.component.UISelectItems,Id: _id8]} does not contain Objects of type SelectItem
                    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
                    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
                    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
                    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
                    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
                    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
                    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
                    ... 25 more


                    • 7. Re: Binding Dropdown To Database Table Using Seam..
                      johnurban Newbie

                      I figured it out. I had to add this code to the bottom of my factory method:


                       List selectItems=new ArrayList();
                       for (Iterator iterator = roomListByOrganization.iterator(); iterator.hasNext();)
                       {
                       Room value = (Room)iterator.next();
                       SelectItem item = new SelectItem(value, value.getName());
                       selectItems.add(item);
                       }
                      
                       roomListByOrganization = selectItems;
                      


                      This doesn't seem correct...??? But it does work.