5 Replies Latest reply on Sep 24, 2010 11:49 PM by Raminder Singh Saluja

    Websphere, Seam, Cannot Create Seam component

    Raminder Singh Saluja Newbie
      Hi,

      I have been trying to deploy our Seam application on a Websphere 7.0.0.11 environment. I have been trying to resolve one issue which has been bothering me for the past 3 days and I do not know what to do. I searched for the forums and did not find a resolution to this. The problem that i am encountering is as follows...

      I open a page and i see that the page loads correctly with all values on the page. If i click on an Ajax event, it throws an error on SelectOne Component --->
      and interestingly I am seeing a warning

      seam.Component (2028) - Cannot create Seam component, scope is not active: purchaseOrderQueries(CONVERSATION)
      Can someone please help me on this???



      [9/23/10 15:52:14:187 EDT] 00000030 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet Faces Servlet in application posSeam. Exception created : javax.servlet.ServletException: "Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(doctype).
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
          at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
          at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
          at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
          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.web.MultipartFilter.doFilter(MultipartFilter.java:90)
          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.ExceptionFilter.doFilter(ExceptionFilter.java:64)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
          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.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
          at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
          at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
          at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at com.criti.spectrum.base.SessionIdFilter.doFilter(SessionIdFilter.java:76)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
          at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184)
          at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
          at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
          at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
          at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
          at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
          at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
          at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
          at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
          at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
          at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
          at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
          at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
          at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
          at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
          at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
          at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
          at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
          at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
      Caused by: java.lang.IllegalArgumentException: "Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(doctype).
          at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:340)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:195)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:260)
          at com.sun.faces.util.DebugUtil.printTree(DebugUtil.java:178)
          at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:214)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
          at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
          ... 50 more

        • 1. Re: Websphere, Seam, Cannot Create Seam component
          Raminder Singh Saluja Newbie
          This is my components.xml file
          ==================================================

          <?xml version="1.0" encoding="UTF-8"?>
          <components xmlns="http://jboss.com/products/seam/components"
               xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence"
               xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm"
               xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail"
               xmlns:framework="http://jboss.com/products/seam/framework" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:web="http://jboss.com/products/seam/web" xmlns:async="http://jboss.com/products/seam/async"
               xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                           http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                           http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
                           http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
                           http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                           http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd
                           http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
                           http://jboss.com/products/seam/components xmlns:web=http://jboss.com/products/seam/web
                           http://jboss.com/products/seam/components-2.0.xsd http://jboss.com/products/seam/async
                           http://jboss.com/products/seam/async-2.0.xsd"
               xmlns:excel="http://jboss.com/products/seam/excel">

               <core:init debug="true" jndi-pattern="@jndiPattern@" />

               <core:manager concurrent-request-timeout="500"
                    conversation-timeout="120000" conversation-id-parameter="cid"
                    parent-conversation-id-parameter="pid" />


               <web:cache-control-filter name="textCacheControlFilter"
                    regex-url-pattern=".*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg)" value="max-age=86400" />


               <core:resource-loader>
                    <core:bundle-names>
                         <value>messages</value>
                         <value>Spectrum</value>
                         <value>Transaction</value>
                         <value>UserMessages</value>
                         <value>ws</value>

                    </core:bundle-names>
               </core:resource-loader>

               <persistence:managed-persistence-context
                    name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/posSeamEntityManagerFactory" />
               <!--
                    <drools:rule-base name="securityRules"> <drools:rule-files>
                    <value>/security.drl</value> </drools:rule-files> </drools:rule-base>
                    execute="#{redirect.returnToCapturedView}" /> </event>
               -->
               <event type="org.jboss.seam.security.notLoggedIn">
                    <action execute="#{redirect.captureCurrentView}" />
               </event>
               <event type="org.jboss.seam.security.loginSuccessful">
                    <action execute="#{redirect.returnToCapturedView}" />
               </event>



               <security:identity authenticate-method="#{auth.authenticate}" />

               <!-- For use with jBPM pageflow or process management -->

               <bpm:jbpm>
                    <bpm:process-definitions>
                         <value>pos.jpdl.xml</value>
                    </bpm:process-definitions>
               </bpm:jbpm>

               <!-- Install the QuartzDispatcher -->
               <async:quartz-dispatcher />

               <!-- SMTP Details -->

               <mail:mail-session host="smtp3.netcore.co.in" port="25"
                    username="citi@citi-in.com" password="Gt%3uFrQ67" />

               <web:character-encoding-filter encoding="UTF-8"
                    override-client="true" url-pattern="*.seam" />

          </components>

          =============================================================
          • 2. Re: Websphere, Seam, Cannot Create Seam component
            Raminder Singh Saluja Newbie
            Sorry i put in the wrong components.xml file above..
            ============================================================
            The actual file is as given here



            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://jboss.com/products/seam/components"
                 xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence"
                 xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm"
                 xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail"
                 xmlns:framework="http://jboss.com/products/seam/framework" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:web="http://jboss.com/products/seam/web" xmlns:async="http://jboss.com/products/seam/async"
                 xmlns:transaction="http://jboss.com/products/seam/transaction"
                 xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
                             http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
                             http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
                             http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
                             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
                             http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.2.xsd
                             http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
                             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.2.xsd
                             http://jboss.com/products/seam/components xmlns:web=http://jboss.com/products/seam/web
                             http://jboss.com/products/seam/components-2.2.xsd http://jboss.com/products/seam/async
                             http://jboss.com/products/seam/async-2.2.xsd"
                 xmlns:excel="http://jboss.com/products/seam/excel">

                <core:init jndi-pattern="ejblocal:#{ejbName}" debug="true" />
                <!-- <core:init  transaction-management-enabled ="true"/> -->
               
                <transaction:ejb-transaction/>


                <core:manager conversation-timeout="120000"
                              concurrent-request-timeout="500"
                              conversation-id-parameter="cid"/>

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


                 <web:cache-control-filter name="textCacheControlFilter"
                      regex-url-pattern=".*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg)" value="max-age=86400" />


                 <core:resource-loader>
                      <core:bundle-names>
                           <value>messages</value>
                           <value>Spectrum</value>
                           <value>Transaction</value>
                           <value>UserMessages</value>
                           <value>ws</value>

                      </core:bundle-names>
                 </core:resource-loader>

                 <event type="org.jboss.seam.security.notLoggedIn">
                      <action execute="#{redirect.captureCurrentView}" />
                 </event>
                 <event type="org.jboss.seam.security.loginSuccessful">
                      <action execute="#{redirect.returnToCapturedView}" />
                 </event>



                 <security:identity authenticate-method="#{auth.authenticate}" />

                 <!-- For use with jBPM pageflow or process management -->

                 <bpm:jbpm>
                      <bpm:process-definitions>
                           <value>pos.jpdl.xml</value>
                      </bpm:process-definitions>
                 </bpm:jbpm>

                 <!-- Install the QuartzDispatcher -->
                 <async:quartz-dispatcher />

                 <!-- SMTP Details -->

                 <web:character-encoding-filter encoding="UTF-8"
                      override-client="true" url-pattern="*.seam" />

            </components>
            • 3. Re: Websphere, Seam, Cannot Create Seam component
              Raminder Singh Saluja Newbie

              The SFSB causing this error is as given below


              package com.criti.spectrum.ordermgmnt.purchaseorder;
              
              import java.util.ArrayList;
              import java.util.Arrays;
              import java.util.Collections;
              import java.util.List;
              
              import javax.ejb.Remove;
              import javax.ejb.Stateful;
              import javax.faces.convert.ConverterException;
              import javax.faces.event.ActionEvent;
              import javax.persistence.EntityManager;
              import javax.persistence.PersistenceContext;
              import javax.persistence.PersistenceContextType;
              
              import org.jboss.seam.annotations.Begin;
              import org.jboss.seam.annotations.In;
              import org.jboss.seam.annotations.Name;
              import org.jboss.seam.annotations.Out;
              import org.jboss.seam.annotations.web.RequestParameter;
              
              import com.criti.spectrum.base.SpectrumUIBaseAction;
              import com.criti.spectrum.commons.CommonQueriesMasterForAuthorization;
              import com.criti.spectrum.model.AuthUsers;
              import com.criti.spectrum.model.masters.MstCurrency;
              import com.criti.spectrum.model.masters.MstDocumentTypes;
              import com.criti.spectrum.model.masters.MstSite;
              import com.criti.spectrum.model.order.OrderHdr;
              import com.criti.spectrum.util.DTOComparator;
              
              @Stateful
              @Name("purchaseOrderQueries")
              public class PurchaseOrderQueriesImpl extends SpectrumUIBaseAction implements
                        PurchaseOrderQueries {
              
                   @PersistenceContext(type = PersistenceContextType.EXTENDED)
                   private EntityManager em;
              
                   private String sortField = "getId.getDocumentNumber";
                   private boolean sortAscending = true;
              
                   @In(value = "currentUser", required = true)
                   private AuthUsers currentUser;
              
                   @In(required = false)
                   @Out(required = false)
                   List<MstCurrency> mstCurrencylist;
              
                   @In(required = false)
                   // @Out(required = false).. should not use..
                   private OrderHdr orderHdrEntity;
              
                   List<OrderHdr> orderHdrList;
              
                   List<OrderHdr> orderHdrListForClose;
              
                   List<OrderHdr> orderHdrListForEdit;
              
                   List<OrderHdr> orderHdrListForApproval;
              
                   List<MstDocumentTypes> mstDocumentTypeslist;
              
                   int pageIndex = 1;
              
                   @RequestParameter
                   String docNo;
              
                   @RequestParameter
                   String siteCode;
              
                   @RequestParameter
                   String finYr;
              
                   @In(required = false)
                   @Out(required = false)
                   List<OrderHdr> orderHdrInboxList;
              
                   @In(required = false, create = true)
                   private CommonQueriesMasterForAuthorization commonQueriesMasterForAuthorization;
              
                   public List<OrderHdr> getOrderHdrList() {
                        messageLogger.info("MasterAction: getOrderHdrList()");
                        messageLogger.info("MasterAction: getOrderHdrList():orderHdrEntity--> "
                                  + orderHdrEntity);
              
                        // This is just for Purchase ORder hence document types has to be
                        // Purcahse order only
              
                        String docNo = "";
                        String documentTypes = getProperty("DocumentType.PO");
                        StringBuffer siteCodeString = getSiteListForTransaction("task.PO.create");
              
                        if (orderHdrEntity != null && orderHdrEntity.getId() != null
                                  && orderHdrEntity.getId().getDocumentNumber() != null
                                  && !orderHdrEntity.getId().getDocumentNumber().equals("")) {
              
                             messageLogger.info("getOrderHdrList():DocumentNumber--> "
                                       + orderHdrEntity.getId().getDocumentNumber());
              
                             if (orderHdrEntity.getId().getDocumentNumber() != null
                                       && orderHdrEntity.getId().getDocumentNumber()
                                                 .equalsIgnoreCase("")) {
                                  docNo = orderHdrEntity.getId().getDocumentNumber() + "%";
                             }
              
                             orderHdrList = em
                                       .createQuery(
                                                 "from OrderHdr o where "
                                                           + "o.mstDocumentTypes.documentType= :documentType "
                                                           + " and o.id.documentNumber like :documentNumber and o.status= :status and o.mstSite.siteCode in "
                                                           + siteCodeString.toString()).setParameter(
                                                 "documentType", documentTypes).setParameter(
                                                 "documentNumber",
                                                 orderHdrEntity.getId().getDocumentNumber() + "%")
                                       .setParameter("status", true).getResultList();
                             messageLogger.info("MasterAction: getOrderHdrList().size-->"
                                       + orderHdrList.size());
                             return orderHdrList;
                        } else if (orderHdrList == null) {
              
                             orderHdrList = em
                                       .createQuery(
                                                 "from OrderHdr o where "
                                                           + "o.mstDocumentTypes.documentType= :documentType and o.status= :status and o.mstSite.siteCode in "
                                                           + siteCodeString.toString()).setParameter(
                                                 "documentType", documentTypes).setParameter(
                                                 "status", true).getResultList();
                             messageLogger.info("MasterAction: getOrderHdrList().size-->"
                                       + orderHdrList.size());
                             return orderHdrList;
              
                        } else {
                             return orderHdrList;
                        }
              
                   }
              
                   public List<OrderHdr> getOrderHdrListForApproval() {
                        messageLogger.info("MasterAction: getOrderHdrList()");
                        messageLogger.info("MasterAction: getOrderHdrList():orderHdrEntity--> "
                                  + orderHdrEntity);
              
                        // This is just for Purchase ORder hence document types has to be
                        // Purcahse order only
              
                        String docNo = "";
                        String documentTypes = getProperty("DocumentType.PO");
                        String approvalStatus = getProperty("PO.ApprovalStatus");
              
                        StringBuffer siteCodeString = getSiteListForTransaction("task.PO.approve");
              
                        if (orderHdrEntity != null && orderHdrEntity.getId() != null
                                  && orderHdrEntity.getId().getDocumentNumber() != null
                                  && !orderHdrEntity.getId().getDocumentNumber().equals("")) {
              
                             messageLogger.info("getOrderHdrList():DocumentNumber--> "
                                       + orderHdrEntity.getId().getDocumentNumber());
              
                             if (orderHdrEntity.getId().getDocumentNumber() != null
                                       && orderHdrEntity.getId().getDocumentNumber()
                                                 .equalsIgnoreCase("")) {
                                  docNo = orderHdrEntity.getId().getDocumentNumber() + "%";
                             }
              
                             orderHdrListForApproval = em
                                       .createQuery(
                                                 "from OrderHdr o where "
                                                           + "o.mstDocumentTypes.documentType= :documentType "
                                                           + " and o.id.documentNumber like :documentNumber  and (o.nextApproverId = :approverId or o.nextApproverId in "
                                                           + getCurrentUserRoleListStringForQuery()
                                                           + ")  "
                                                           + " and o.nextApprovalAt=:nextApprovalAt and o.processInstanceId is not null and o.approvedLevel =:approvedLevel "
                                                           + "and o.status= :status and o.mstSite.siteCode in "
                                                           + siteCodeString.toString()).setParameter(
                                                 "documentType", documentTypes).setParameter(
                                                 "documentNumber",
                                                 orderHdrEntity.getId().getDocumentNumber() + "%")
                                       .setParameter("approvedLevel", approvalStatus)
                                       .setParameter("approverId", currentUser.getUserId())
                                       .setParameter("nextApprovalAt", getSiteCode())
                                       .setParameter("status", true).getResultList();
                             messageLogger.info("MasterAction: getOrderHdrList().size-->"
                                       + orderHdrListForApproval.size());
                        } else if (orderHdrListForApproval == null) {
              
                             orderHdrListForApproval = em
                                       .createQuery(
                                                 "from OrderHdr o where "
                                                           + "o.mstDocumentTypes.documentType= :documentType and o.approvedLevel =:approvedLevel "
                                                           + "and o.nextApprovalAt=:nextApprovalAt and o.status= :status and o.processInstanceId is not null and (o.nextApproverId = :approverId or o.nextApproverId in "
                                                           + getCurrentUserRoleListStringForQuery()
                                                           + " ) and o.mstSite.siteCode in "
                                                           + siteCodeString.toString()).setParameter(
                                                 "documentType", documentTypes).setParameter(
                                                 "status", true).setParameter("approvedLevel",
                                                 approvalStatus).setParameter("approverId",
                                                 currentUser.getUserId()).setParameter(
                                                 "nextApprovalAt", getSiteCode()).getResultList();
                             messageLogger.info("MasterAction: getOrderHdrList().size-->"
                                       + orderHdrListForApproval.size());
              
                        }
              
                        return orderHdrListForApproval;
              
                   }
              
                   public List<OrderHdr> getOrderHdrListForClose() {
              
                        messageLogger
                                  .info("purchaseOrderQueries: orderHdrListForClose():orderHdrEntity--> "
                                            + orderHdrEntity);
                        String documentTypes = getProperty("DocumentType.PO");
                        StringBuffer siteCodeString = getSiteListForTransaction("task.PO.close");
              
                        if (orderHdrEntity != null && orderHdrEntity.getId() != null
                                  && orderHdrEntity.getId().getDocumentNumber() != null
                                  && !orderHdrEntity.getId().getDocumentNumber().equals("")) {
              
                             messageLogger.info("getOrderHdrListForClose():DocumentNumber--> "
                                       + orderHdrEntity.getId().getDocumentNumber());
              
                             orderHdrListForClose = em
                                       .createQuery(
                                                 "from OrderHdr o where o.mstDocumentTypes.documentType= :documentType "
                                                           + " and o.id.documentNumber like :documentNumber and o.status= :status and o.isClosed= :isClosed and o.mstSite.siteCode in "
                                                           + siteCodeString.toString()).setParameter(
                                                 "documentType", documentTypes).setParameter(
                                                 "documentNumber",
                                                 orderHdrEntity.getId().getDocumentNumber() + "%")
                                       .setParameter("isClosed", false).setParameter("status",
                                                 true).getResultList();
                             messageLogger.info("PO queries :getOrderHdrListForClose.size-->"
                                       + orderHdrListForClose.size());
                             return orderHdrListForClose;
                        } else if (orderHdrListForClose == null) {
                             orderHdrListForClose = em
                                       .createQuery(
                                                 "from OrderHdr o where o.mstDocumentTypes.documentType= :documentType "
                                                           + " and o.isClosed= :isClosed and o.status= :status and o.mstSite.siteCode in "
                                                           + siteCodeString.toString()).setParameter(
                                                 "documentType", documentTypes).setParameter(
                                                 "isClosed", false).setParameter("status", true)
                                       .getResultList();
                             messageLogger.info("PO queries : getOrderHdrListForClose().size-->"
                                       + orderHdrListForClose.size());
                             return orderHdrListForClose;
              
                        } else {
                             return orderHdrListForClose;
                        }
              
                   }
              
                   public List<OrderHdr> getOrderHdrListForEdit() {
              
                        messageLogger
                                  .info("purchaseOrderQueries: orderHdrListForClose():orderHdrEntity--> "
                                            + orderHdrEntity);
              
                        String documentTypes = getProperty("DocumentType.PO");
              
                        if (orderHdrEntity != null && orderHdrEntity.getId() != null
                                  && orderHdrEntity.getId().getDocumentNumber() != null
                                  && !orderHdrEntity.getId().getDocumentNumber().equals("")) {
              
                             messageLogger.info("getOrderHdrList():DocumentNumber--> "
                                       + orderHdrEntity.getId().getDocumentNumber());
              
                             orderHdrListForEdit = em
                                       .createQuery(
                                                 "from OrderHdr o where o.mstDocumentTypes.documentType= :documentType "
                                                           + "and o.status= :status and o.id.documentNumber like :documentNumber and o.isClosed= :isClosed ")
                                       .setParameter("documentType", documentTypes).setParameter(
                                                 "documentNumber",
                                                 orderHdrEntity.getId().getDocumentNumber() + "%")
                                       .setParameter("isClosed", false).setParameter("status",
                                                 true).getResultList();
                             messageLogger.info("PO queries : getOrderHdrList().size-->"
                                       + orderHdrListForEdit.size());
                             return orderHdrListForEdit;
                        } else if (orderHdrListForEdit == null) {
                             orderHdrListForEdit = em
                                       .createQuery(
                                                 "from OrderHdr o where o.mstDocumentTypes.documentType= :documentType "
                                                           + " and o.isClosed= :isClosed and o.status= :status")
                                       .setParameter("documentType", documentTypes).setParameter(
                                                 "status", true).setParameter("isClosed", false)
                                       .getResultList();
                             messageLogger.info("PO queries : getOrderHdrListFor Edit().size-->"
                                       + orderHdrListForEdit.size());
                             return orderHdrListForEdit;
              
                        } else {
                             return orderHdrListForEdit;
                        }
              
                   }
              
                   @Remove
                   @org.jboss.seam.annotations.Destroy
                   public void destroy() {
              
                   }
              
                   public void inboxFilterAction() {
                        // em.clear();
              
                        List<MstSite> lst = commonQueriesMasterForAuthorization
                                  .getMstSiteListForTransaction("CREATE_PURCHASE_ORDER");
                        List<String> strSitecode = new ArrayList<String>();
                        for (MstSite mstSite : lst) {
                             strSitecode.add(mstSite.getSiteCode());
                        }
                        StringBuffer sites = getSiteListStringForQuery(strSitecode);
                        String backOffDoc = "";
                        for (MstDocumentTypes docTye : mstDocumentTypeslist) {
                             if (backOffDoc.equals(""))
                                  backOffDoc += "'" + docTye.getDocumentType() + "'";
                             else
                                  backOffDoc += ",'" + docTye.getDocumentType() + "'";
                        }
                        if (backOffDoc.equals(""))
                             backOffDoc += "''";
              
                        List<OrderHdr> finalList = new ArrayList<OrderHdr>();
                        String docNo = "";
                        if (orderHdrEntity != null
                                  && orderHdrEntity.getMstDocumentTypes().getDocumentType() != null
                                  && orderHdrEntity.getId().getDocumentNumber() != null) {
                             em.clear();
                             orderHdrInboxList = em
                                       .createQuery(
                                                 " from OrderHdr o where "
                                                           + "o.mstDocumentTypes.documentType= :documentType and o.status =:status "
                                                           + " and o.id.documentNumber like :documentNumber and o.id.siteCode IN "
                                                           + sites + " ").setParameter(
                                                 "documentType",
                                                 orderHdrEntity.getMstDocumentTypes()
                                                           .getDocumentType()).setParameter("status",
                                                 true).setParameter("documentNumber",
                                                 orderHdrEntity.getId().getDocumentNumber() + "%")
                                       .getResultList();
              
                        }
              
                        else if (orderHdrEntity != null
                                  && orderHdrEntity.getId().getDocumentNumber() != null) {
                             em.clear();
                             orderHdrInboxList = em
                                       .createQuery(
                                                 "from OrderHdr o where "
                                                           + "  o.id.documentNumber like :documentNumber and o.status =:status and o.mstDocumentTypes.documentType in ("
                                                           + backOffDoc + ") and o.id.siteCode IN "
                                                           + sites + " ").setParameter(
                                                 "documentNumber",
                                                 orderHdrEntity.getId().getDocumentNumber() + "%")
                                       .setParameter("status", true).getResultList();
              
                        } else if (orderHdrEntity != null
                                  && orderHdrEntity.getMstDocumentTypes().getDocumentType() != null) {
                             orderHdrInboxList = em
                                       .createQuery(
                                                 "from OrderHdr o where "
                                                           + "o.mstDocumentTypes.documentType= :documentType and o.status =:status and o.id.siteCode IN "
                                                           + sites + " ").setParameter(
                                                 "documentType",
                                                 orderHdrEntity.getMstDocumentTypes()
                                                           .getDocumentType()).setParameter("status",
                                                 true).getResultList();
                        } else {
                             orderHdrInboxList = em
                                       .createQuery(
                                                 "from OrderHdr o where o.status =:status and o.mstDocumentTypes.documentType in ("
                                                           + backOffDoc
                                                           + ") and and o.id.siteCode IN "
                                                           + sites
                                                           + " ").setParameter("status", true)
                                       .getResultList();
                        }
              
                        if (orderHdrEntity != null && orderHdrEntity.getStatusArray() != null
                                  && orderHdrEntity.getStatusArray().length > 0) {
              
                             Arrays.sort(orderHdrEntity.getStatusArray());
                             int i = Arrays.binarySearch(orderHdrEntity.getStatusArray(), "All");
                             // System.out.println(i+">><<><"+orderHdrEntity.getStatusArray());
                             if (i < 0) {
                                  for (String status : orderHdrEntity.getStatusArray()) {
                                       for (OrderHdr hdr : orderHdrInboxList) {
                                            if (getStatus(hdr).equalsIgnoreCase(status)) {
                                                 finalList.add(hdr);
                                            }
                                       }
              
                                  }
                             } else {
                                  finalList.addAll(orderHdrInboxList);
                             }
                             orderHdrInboxList = finalList;
                        }
                        for (OrderHdr a : orderHdrInboxList) {
                             messageLogger.info(a.getId().getDocumentNumber());
                             messageLogger.info(a.getMstDocumentTypes().getDocumentTypeDesc());
                             messageLogger.info(a.getMstSupplier().getSupplierName());
                             messageLogger.info(a.getMstSite().getSiteOfficialName());
                        }
                        pageIndex = 1;
                   }
              
                   @Begin(join = true)
                   public List<OrderHdr> getOrderHdrInboxList() {
              
                        List<MstSite> lst = commonQueriesMasterForAuthorization
                                  .getMstSiteListForTransaction("Menu.Inbox");
                        List<String> strSitecode = new ArrayList<String>();
                        for (MstSite mstSite : lst) {
                             strSitecode.add(mstSite.getSiteCode());
                        }
                        StringBuffer sites = getSiteListStringForQuery(strSitecode);
              
                        if (orderHdrInboxList == null) {
                             orderHdrInboxList = em
                                       .createQuery(
                                                 " from OrderHdr o where o.status =:status and o.mstDocumentTypes.documentType <>:SOB "
                                                           + "and o.id.siteCode IN "
                                                           + sites
                                                           + "  order by o.id.documentNumber ")
                                       .setParameter("status", true).setParameter("SOB", "SO201")
                                       .getResultList();
              
                             for (OrderHdr a : orderHdrInboxList) {
                                  messageLogger.info(a.getId().getDocumentNumber());
                                  messageLogger.info(a.getMstDocumentTypes()
                                            .getDocumentTypeDesc());
                                  messageLogger.info(a.getMstSupplier().getSupplierName());
                                  messageLogger.info(a.getMstSite().getSiteOfficialName());
                             }
                             return orderHdrInboxList;
              
                        } else {
              
                             return orderHdrInboxList;
                        }
              
                   }
              
                   public void setOrderHdrInboxList(List<OrderHdr> orderHdrInboxList) {
                        this.orderHdrInboxList = orderHdrInboxList;
                   }
              
                   public String getStatus(OrderHdr arg2) {
                        // TODO Auto-generated method stub
                        String status = "";
              
                        try {
              
                             OrderHdr orderHdrEntity = (OrderHdr) arg2;
              
                             if (orderHdrEntity.getApprovedLevel() != null
                                       && orderHdrEntity.getApprovedLevel().equals("-1")
                                       && (orderHdrEntity.getIsClosed() != null && !orderHdrEntity
                                                 .getIsClosed())
                                       && (orderHdrEntity.getIsFreezed() != null && !orderHdrEntity
                                                 .getIsFreezed())) {
                                  status = getMessageFromPropertyFile("Rejected");
                             }
              
                             else if ((orderHdrEntity.getIsClosed() != null && orderHdrEntity
                                       .getIsClosed())
                                       && (orderHdrEntity.getIsFreezed() != null && !orderHdrEntity
                                                 .getIsFreezed())) {
                                  status = getMessageFromPropertyFile("Closed");
                             } else if ((orderHdrEntity.getIsClosed() != null && !orderHdrEntity
                                       .getIsClosed())
                                       && (orderHdrEntity.getIsFreezed() != null && !orderHdrEntity
                                                 .getIsFreezed())
                                       && (orderHdrEntity.getApprovedLevel() != null && orderHdrEntity
                                                 .getApprovedLevel().equals("0"))
                                       && orderHdrEntity.getProcessInstanceId() != null) {
                                  status = getMessageFromPropertyFile("Submitted");
                             }
              
                             else if ((orderHdrEntity.getIsClosed() != null && !orderHdrEntity
                                       .getIsClosed())
                                       && (orderHdrEntity.getIsFreezed() != null && !orderHdrEntity
                                                 .getIsFreezed())
                                       && (orderHdrEntity.getApprovedLevel() != null && orderHdrEntity
                                                 .getApprovedLevel().equals("0"))) {
                                  status = getMessageFromPropertyFile("Provisional");
                             }
              
                             else if ((orderHdrEntity.getIsClosed() != null && !orderHdrEntity
                                       .getIsClosed())
                                       && (orderHdrEntity.getIsFreezed() != null && !orderHdrEntity
                                                 .getIsFreezed())
                                       && orderHdrEntity.getApprovedLevel() == null) {
                                  status = getMessageFromPropertyFile("Provisional");
                             }
              
                             else if ((orderHdrEntity.getIsClosed() != null && !orderHdrEntity
                                       .getIsClosed())
                                       && (orderHdrEntity.getIsFreezed() != null && !orderHdrEntity
                                                 .getIsFreezed())
                                       && (orderHdrEntity.getApprovedLevel() != null && orderHdrEntity
                                                 .getApprovedLevel().equals("1"))) {
                                  status = getMessageFromPropertyFile("Approved");
                             }
              
                             // else if (orderHdrEntity.getIsFreezed()!= null &&
                             // orderHdrEntity.getIsFreezed()) {
                             // status = "frozen";
                             // }
                             else {
                                  status = getMessageFromPropertyFile("Provisional");
                             }
              
                        }
              
                        catch (Exception e) {
                             throw new ConverterException(e);
                        }
                        return status;
                   }
              
                   public String getSortField() {
                        return sortField;
                   }
              
                   public boolean isSortAscending() {
                        return sortAscending;
                   }
              
                   public void sortDataList(ActionEvent event) {
                        em.clear();
                        // System.out.println("sortDataList");
                        String sortFieldAttribute = getAttribute(event, "sortField");
              
                        // Get and set sort field and sort order.
                        if (sortField != null && sortField.equals(sortFieldAttribute)) {
                             sortAscending = !sortAscending;
                        } else {
                             sortField = sortFieldAttribute;
                             sortAscending = true;
                        }
              
                        // Sort results.
                        if (sortField != null) {
                             Collections.sort(orderHdrInboxList, new DTOComparator(sortField,
                                       sortAscending));
                        }
                   }
              
                   private static String getAttribute(ActionEvent event, String name) {
                        return (String) event.getComponent().getAttributes().get(name);
                   }
              
                   public List<MstDocumentTypes> getMstDocumentTypeslist() {
                        if (mstDocumentTypeslist == null) {
                             messageLogger.info("Loading the Master Document Types Details...");
                             mstDocumentTypeslist = em.createQuery(
                                       "from MstDocumentTypes m where m.isBackOfficeDocument=:isBackOfficeDocument"
                                                 + " and  m.status =:status").setParameter(
                                       "isBackOfficeDocument", true).setParameter("status", true)
                                       .getResultList();
                        }
                        return mstDocumentTypeslist;
                   }
              
                   public int getPageIndex() {
                        return pageIndex;
                   }
              
                   public void setPageIndex(int pageIndex) {
                        this.pageIndex = pageIndex;
                   }
              
              }
              

              • 4. Re: Websphere, Seam, Cannot Create Seam component
                Hui Onn Tan Newbie

                From the error stack trace, it seems the error is due to wrong child component type in selectOne component. Since you didn't provide the xhtml, I guess you can try to return a list of SelectItem as options (in PurchaseOrderQueriesImpl) or use s:entityConverter (in your xhtml)

                • 5. Re: Websphere, Seam, Cannot Create Seam component
                  Raminder Singh Saluja Newbie

                  I have an AJAX method that is being called when i change the Dropdown. Even the function is not getting called. I dont know where to begin or find out what the problem is.
                  I am returning an ArrayList to the calling function. This error is occurring only when we have an AJAX component... Is there something that i need to enable or some property that might be missing. This application works fine on Jboss 4.2.3 App server and we are trying to port this on to Websphere App server 7.0


                  I have followed instructions and was able to deploy the application on WAS 7.0 , but am ending up with this error throughout the app where we are using AJAX (which is almost the whole app)