11 Replies Latest reply on Sep 28, 2010 3:09 AM by lvdberg

    Websphere Seam and SelectOne Components

      Hi Guys,

      I have noticed an interesting problem and i do not know what the possible solution could be. I am trying to deploy my application on a Websphere App server and am seeing the following error.

      My page loads correctly the first time i land on it. As soon as i Click on any event on the page. It complains about the Selectone component on the page. Apparently the error goes away as soon as i remove the SelectOne drop down... I am not too sure what is wrong here or what i am missing... The error that i get is as given below
      Can someone help me or guide me here please...


      Exception during request processing:
      Caused by javax.servlet.ServletException with message: ""Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(doctype)."

      javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
      com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      com.criti.spectrum.base.SessionIdFilter.doFilter(SessionIdFilter.java:76)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184)
      com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
      com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
      com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
      com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
      com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
      com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
      com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
      com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
      com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
      com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
      com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

      Caused by java.lang.IllegalArgumentException with message: ""Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(doctype)."

      com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:340)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:195)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
      com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:178)
      com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:214)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
      com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      com.criti.spectrum.base.SessionIdFilter.doFilter(SessionIdFilter.java:76)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184)
      com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
      com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
      com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
      com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
      com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
      com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
      com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
      com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
      com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
      com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
      com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
      com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

        • 1. Re: Websphere Seam and SelectOne Components
          lvdberg

          Hi,


          It would be very helpful if you send us some code., only the relevant parts and not the whole page.


          Leo

          • 2. Re: Websphere Seam and SelectOne Components
            Hi Leo,

            I noticed a few things in the IBM log files...

            CMStatefulBeanO(BeanId(posSeam#jboss-seam.jar#EjbSynchronizations, 4F3A7CB2-012B-4000-E000-11B8C0A80165), state = DESTROYED)

            and
            [9/26/10 14:02:45:921 EDT] 00000032 EJBContainerI I   CNTR0167I: The server is binding the org.jboss.seam.transaction.LocalEjbSynchronizations interface of the EjbSynchronizations enterprise bean in the jboss-seam.jar module of the posSeam application.  The binding location is: ejblocal:posSeam/jboss-seam.jar/EjbSynchronizations#org.jboss.seam.transaction.LocalEjbSynchronizations


            which i would assume means that the JNDI name for EJBSynchronizations is as given above... Could this be a problem which is causing the application to misbehave?

            I have the following entry in the web.xml file

              <ejb-local-ref>
                <ejb-ref-name>ejblocal:EjbSynchronizations</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
              </ejb-local-ref>

            ==============================================================
            Snippet of PurchaseOrderView

            <h:selectOneMenu id="doctype"
                                          value="#{orderHdrEntity.mstDocumentTypes.documentType}"
                                          style="width : 131px; height : 19px;">
                                          <f:selectItem itemLabel="#{messages.All}" />
                                          <s:selectItems itemValue="#{doctype.documentType}"
                                               value="#{purchaseOrderQueries.mstDocumentTypeslist}" var="doctype"
                                               label="#{messages[doctype.documentTypeDesc]}" hideNoSelectionLabel="true" />
                                     </h:selectOneMenu>




            • 3. Re: Websphere Seam and SelectOne Components
              @Stateful
              @Name("purchaseOrderQueries")
              @Scope(ScopeType.SESSION)
              public class PurchaseOrderQueriesImpl extends SpectrumUIBaseAction implements
                        PurchaseOrderQueries {
              
                   @PersistenceContext
                   private EntityManager entityManager;
              
                   @In(required = false)
                   @Out(required = false)
                   List<MstDocumentTypes> mstDocumentTypeslist;
              
                   public List<MstDocumentTypes> getMstDocumentTypeslist() {
                        messageLogger.info("Loading the Master Document Types Details...1111" +entityManager);
              
                        if (mstDocumentTypeslist == null) {
                             messageLogger.info("Loading the Master Document Types Details...");
                             mstDocumentTypeslist = entityManager.createQuery(
                                       "from MstDocumentTypes m where m.isBackOfficeDocument=:isBackOfficeDocument"
                                                 + " and  m.status =:status").setParameter(
                                       "isBackOfficeDocument", true).setParameter("status", true)
                                       .getResultList();
                        }
                        messageLogger.info("Loading the Master Document Types Details...2222" );
                        messageLogger.info(mstDocumentTypeslist);
                        return mstDocumentTypeslist;
                   }
              
              
              }
              


              • 4. Re: Websphere Seam and SelectOne Components
                lvdberg

                Hi,


                I suspect it only has to do with the selectbox .


                The lines:




                <f:selectItem itemLabel="#{messages.All}" />
                <s:selectItems itemValue="#{doctype.documentType}"
                



                should give you a child component of type UISelectItem and it apparently doesn't. because it gives an error there.


                Try it first with a simpler approach to see if the code is correct. Also switch to the Seaam managed persistencyContext, should be the same, but gives you some additional advantages. I also think you're missing a Factory annotation on the getMstDocumentTypeslist, because you're calling that piece of code a lot of (unneccesary) times now.


                Leo
                Leo

                • 5. Re: Websphere Seam and SelectOne Components
                  Hi Leo,

                  Thanks for the quick reply.. I did some more investigation..

                  I changed the entityManager to use @In(create=true) ... Interestingly, it still turns out to be null when i click on any link which posts the data back to the server.

                  The above code works amazingly well in Jboss App server.

                  The entityManager definition in components.xml is as given below... I was wondering if we could hire some senior professional in Seam who can work with us on a temporary basis to guide us getting the application deployed on Websphere.

                  The function that reads the data ie getMstDocumentTypeslist() does not get called so I am just lost as to what is the problem. The page gets displayed correctly the first time and throws and error if i click on any link...


                       <persistence:managed-persistence-context name="entityManager"
                              auto-create="true"
                               entity-manager-factory="#{SeamProjectEntityManagerFactory}" />

                      <persistence:entity-manager-factory name="SeamProjectEntityManagerFactory"
                          persistence-unit-name="posSeamDatabase" />


                  Thanks

                  Raminder
                  • 6. Re: Websphere Seam and SelectOne Components

                    Could it be a problem with the version of JSF being used? Honestly.. I had got this working last week on a different system and i dont think i had tried anything different than what i have done here. The issue is I no longer have access to the system as it crashed and I had to reinstall everything...


                    I am just trying to reduce the number of possibilities by understanding the differences between the previous environment and this one...


                    Thanks


                    Raminder

                    • 7. Re: Websphere Seam and SelectOne Components
                      lvdberg

                      Hi,


                      From the bit and pieces I see and your own statement that it works perfectly with JBoss, draws me to the conclusion that you really have a configuration problem. I do think that the first message with the error doesn't have anything to do with configuration.


                      Try to make a clean installation and make sure that all requirments are met. Working with JBoss makes us a bit lazy, because it provides everything out-of-the-box and tuned for the use with Seam. Try to get the persistence stuff working first.


                      Leo

                      • 8. Re: Websphere Seam and SelectOne Components

                        Hie Leo..


                        Finally i have my app running as I wanted to have it work in the first attempt....


                        I created a new environment for my WAS and excluded the upgrade for WAS JDK 7.0.0.11. Probably this patch was causing all the errors and confusion in the first place...



                        The app works super.... except for the JBPM component which works at snail speed... which is a known behavior... :-)



                        Thanks Leo for all your Help..  One question about @Factory... (please pardon my ignorance)


                        Can we use factory method for lists that are user specific? as in rather than having the list as application scope, have it session scope (user specific) so that the function does not get evaluated again and again?



                        We have a lot of functions in our app which do a lot of retrieving based on user and wanted to reduce the number of queries and optimize the app... These queries get called even on refresh of the page... need to optimize the trips to the db


                        Thanks


                        Raminder

                        • 9. Re: Websphere Seam and SelectOne Components
                          lvdberg

                          Hi,


                          if the list is the same for all sessions, the best thing you can do is to create a application-scoped component which does the DB-access and pass the result through a @Unwrap.


                          Something like :




                          @Name("whatever")
                          @Scope(APPLICATION)
                          public class Whatever {
                          
                          private List<STUFF> stuffs;
                          
                          @Unwrap
                          public List<STUFF> getResult(){
                          return stuffs;
                          }
                          
                          @Observer("THE_event_you_watch")
                          public void retrieve(){
                          stuffs = entityManager.createQueery("yourQueryforstuffs").getResultList();
                          }



                          Most of my applications use this kind of approach and it saves a lot of DB-Access


                          Leo

                          • 10. Re: Websphere Seam and SelectOne Components

                            Hi Leo,


                            So from the above i understand that i can use whatever.getResult() in jsf's throughout my app.. and it will return the same value.. till i use some event to update the data :-) is that correct?


                            I have a lot of component like these that are app level.. this will help to clean up the app :-)


                            Do we have anything similar for session scope components?


                            Thanks


                            Raminder

                            • 11. Re: Websphere Seam and SelectOne Components
                              lvdberg

                              Hi,


                              The trick with Session scoped components is to inject the whatever bean and only extract the data you want. You can use also the factory to simplify things further.



                              So something like:




                              @Name("useWhatever)"
                              public class UseWhatever{
                              
                              @In List<STUFF> whatever;
                              
                              @Out List<STUFF> filtered = new ArrayList<STUFF>();
                              
                              public doSomeProcessing(){
                              
                              // Process the injected List
                              // and create the filtered list
                              
                              filtered = ....
                              
                              }