3 Replies Latest reply on Jun 24, 2009 9:02 AM by Tekchand Prasad

    java.lang.String cannot be cast to javax.faces.model.SelectItem with s:selectItems

    Michael Angelo Newbie

      This has to be a bug somewhere. Here is my code:


                           <ice:selectOneMenu id="songArtistId" required="true"
                                              size="1"                                          
                                              value="#{songHome.instance.artist}">
                                <s:selectItems value="#{artistHome.allArtists}" var="artist" label="#{artist.artistName}"/>
                                <s:convertEntity/>
                           </ice:selectOneMenu>
      
      



      artistHome.allArtists is just a list of Artist entities. I get the drop down list and it is built successfully with the artist id as the value and artist name as the label. The problem is when I try to save I get the following:


      14:35:01,683 WARN  [lifecycle] java.lang.String cannot be cast to javax.faces.model.SelectItem
      java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.model.SelectItem
           at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:138)
           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 com.icesoft.faces.component.ext.HtmlSelectOneMenu.validate(HtmlSelectOneMenu.java:688)
           at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
           at javax.faces.component.UIInput.processValidators(UIInput.java:672)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIForm.processValidators(UIForm.java:235)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:700)
           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 com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
           at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:122)
           at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:73)
           at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:28)
           at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
           at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
           at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:42)
           at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
           at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
           at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:62)
           at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:22)
           at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
           at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:153)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
           at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           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:235)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
      14:35:01,683 ERROR [lifecycle] JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /SongEdit.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1b86cb5]
      14:35:01,683 WARN  [ExceptionFilter] handling uncaught exception
      java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.model.SelectItem
           at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:138)
           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 com.icesoft.faces.component.ext.HtmlSelectOneMenu.validate(HtmlSelectOneMenu.java:688)
           at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
           at javax.faces.component.UIInput.processValidators(UIInput.java:672)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIForm.processValidators(UIForm.java:235)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
           at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:700)
           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 com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
           at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:122)
           at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:73)
           at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:28)
           at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
           at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
           at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:42)
           at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
           at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
           at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:62)
           at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:22)
           at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
           at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:153)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
           at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           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:235)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
      14:35:01,683 WARN  [ExceptionFilter] exception root cause
      14:35:01,683 WARN  [ExceptionFilter] running exception handlers