1 Reply Latest reply on Apr 16, 2010 2:22 PM by pomcompot.pomme_compote-seamframework.yahoo.fr

    Cannot create Seam component, scope is not active error

    pomcompot.pomme_compote-seamframework.yahoo.fr

      Hi,


      I am trying to make a wizard with Seam, with one backing bean per screen, with a long running conversation. The first page is named choixLivraison, the second choixEnvironnement with respectively named backing beans. The second page got two radio buttons with a4j;support showing or hiding some parts of the page according to the radio selected. When I click the checkbox, I got this error :


      WARN  [org.jboss.seam.Component]  Cannot create Seam component, scope is not active: choixEnvironnement(CONVERSATION)



      I really don’t understand why my component is unreachable and the point of this message hereunder interesting parts of my code. I often have problems with conversation and a4j interactions.


      Access to ChoixLivraison.xhtml:


      <s:link value="Nouveau déploiement"
              view="/ChoixLivraison.xhtml"
              propagation="none" />
      […]



      ChoixLivraison.xhtml (link to the second page):


      <div class="actionButtons">
          <s:button view="/ChoixEnvironnement.xhtml"
                  propagation="join"
                  value="Sélectionner la cible du déploiement">
              <f:param name="from" value="ChoixLivraison" />
          </s:button>
      </div>
      […]



      ChoixLivraison.page.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
          
          <begin-conversation />
          
          <param name="from" />
      </page>



      ChoixLivraisonBean.java;


      @Stateful
      @Name("choixLivraison")
      @Scope(ScopeType.CONVERSATION)
      public class ChoixLivraisonBean implements ChoixLivraison {
          […]
          @Remove
          public void destroy() {
          }
          
          @Begin(join=true)
          public List<Livraison> getLivraisonList() {
              if (FacesContext.getCurrentInstance().getRenderResponse()) {
                  livraisonList = (List<Livraison>) entityManager.createNamedQuery("Livraison.findAll").getResultList();
              }
              return livraisonList;
          }
          […]
      }



      ChoixEnvironnement.xhtml:


      <h:form>
          <h:selectOneRadio id="groupeEnvironnementChoosen" label="Déployer sur" required="true" value="#{choixEnvironnement.groupeOrEnvLogiqueChoice}">
              <a4j:support event="onchange" reRender="environnementLists" />
              <f:selectItem id="groupeEnvironnementChoice" itemLabel="un groupe d’environnement" itemValue="groupeEnvironnement" />
              <f:selectItem id="envLogiqueChoice" itemLabel="un environnement logique" itemValue="envLogique" />
          </h:selectOneRadio>
          
          <a4j:outputPanel id="environnementLists" ajaxRendered="true">
              […]
          </a4j:outputPanel>
      </h:form>



      ChoixEnvironnement.page.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
          
          <begin-conversation join="true" />
          
          <param name="from" />
      </page>



      ChoixEnvironnementBean.java:


      @Stateful
      @Name("choixEnvironnement")
      @Scope(ScopeType.CONVERSATION)
      public class ChoixEnvironnementBean implements ChoixEnvironnement {
          […]
          @Remove
          public void destroy() {
          }
          
          @Begin(join=true)
          public List<EnvLogique> getEnvLogiqueList() {
              if (FacesContext.getCurrentInstance().getRenderResponse()) {
                  envLogiqueList = (List<EnvLogique>) entityManager.createNamedQuery("EnvLogique.findAll").getResultList();
              }
              return envLogiqueList;
          }
          […]
      }



      I will temporary try with only one backing bean, but it is not as clean as I want.


      Thanks in advance for your help.