2 Replies Latest reply on Nov 24, 2010 7:26 PM by northbright

    WARN:Cannot create Seam component, scope is not active: seamUserRoleList(CONVERSATION)

    northbright

      Hi!


      Why do i always get this warn?
      I'm trying to save a PAGE scoped Entity (id obtained from other xhtml in param).
      It doesn't make any sense. Thank you!


      Warnings:


      WARN  [org.jboss.seam.Component] Cannot create Seam component, scope is not active: seamUserRoleList(CONVERSATION)
      12:17:53,859 WARN  [org.jboss.seam.Component] Cannot create Seam component, scope is not active: seamUserHome(CONVERSATION)



      My entities:



      @Name("seamUserRoleList")
      @Scope(ScopeType.PAGE)
      public class SeamUserRoleList extends EntityQuery<SeamUserRole>
      {
          /**
               * 
               */
              private static final long serialVersionUID = 1L;
      
              public SeamUserRoleList()
          {
              setEjbql("select seamUserRole from SeamUserRole seamUserRole");
          }
      }
      





      @Name("seamUserHome")
      @Scope(ScopeType.PAGE)
      public class SeamUserHome extends EntityHome<SeamUser>
      {
          /**
               * 
               */
              private static final long serialVersionUID = 1L;
              
              @RequestParameter
          Integer seamUserId;
              
          @Override
          public Object getId()
          {
              if (seamUserId == null)
              {
                  return super.getId();
              }
              else
              {
                       return seamUserId;
                      
              }
          }
      
          @Override @Begin
          public void create() {
              super.create();
          }
      
      }




      My xhtml files:
      SeamUserList.xhtml:


      <rich:panel>
                              <f:facet name="header">seamUserList</f:facet>
      
                              <div class="results"><h:outputText value="No seamUser exists"
                                      rendered="#{empty seamUserList.resultList}">
                              </h:outputText> <h:dataTable id="seamUserList" var="seamUser"
                                      value="#{seamUserList.resultList}"
                                      rendered="#{not empty seamUserList.resultList}">
                                      <h:column>
                                              <f:facet name="header">Id</f:facet>
                                              <h:outputText id="seamUserid" value="#{seamUser.userId}">
                                              </h:outputText>
                                      </h:column>
      
                                      <h:column>
                                              <f:facet name="header">UserName</f:facet>
                                              <s:link id="seamUser" value="#{seamUser.username}"
                                                      propagation="none" view="/seamUser.xhtml">
      
                                                      <f:param name="seamUserId" value="#{seamUser.userId}">
                                                      </f:param>
                                              </s:link>
                                      </h:column>
      
                                      <h:column>
                                              <f:facet name="header">Roles</f:facet>
                                              <rich:dataList var="role" value="#{seamUser.roles}">
                                                      <h:outputText value="#{role.toString()}">
                                                      </h:outputText>
                                              </rich:dataList>
                                      </h:column>
      
                              </h:dataTable></div>
      
                      </rich:panel>
      



      End SeamUser.xhtml:



      <h:form id="seamUserForm">
      
                              <rich:panel>
                                      <f:facet name="header">seamUser</f:facet>
      
                                      <s:decorate id="nameField" template="layout/edit.xhtml">
                                              <ui:define name="label">Name</ui:define>
                                              <h:inputText id="username" required="true"
                                                      value="#{seamUserHome.instance.username}" />
                                      </s:decorate>
      
                                      <s:decorate id="passwordField" template="layout/edit.xhtml">
                                              <ui:define name="label">Password</ui:define>
                                              <h:inputText id="password" required="true"
                                                      value="#{seamUserHome.instance.password}" />
                                      </s:decorate>
      
                                      <div style="clear: both" />
      
      
                                      <rich:panel rendered="#{seamUserHome.managed}">
                                              <f:facet name="header">Set UserRoles</f:facet>
                                              <rich:listShuttle id="shuttle"
                                                      sourceValue="#{seamUserRoleList.resultList}" sourceRequired="true"
                                                      targetRequired="false" var="role"
                                                      targetValue="#{seamUserHome.instance.roles.toArray()}"
                                                      sourceCaptionLabel="Available Roles"
                                                      targetCaptionLabel="Current Roles of User"
                                                      converter="org.jboss.seam.ui.EntityConverter">
                                                      <rich:column>
                                                              <h:outputText value="#{role.rolename}"></h:outputText>
                                                      </rich:column>
      
      
      
                                              </rich:listShuttle>
                                              <h:commandButton action="#{seamUserHome.update}"
                                                      value="Save Roles">
                                              </h:commandButton>
                                      </rich:panel>
      
                                      <div class="actionButtons"><h:commandButton id="save"
                                              value="Save" action="#{seamUserHome.persist}"
                                              rendered="#{!seamUserHome.managed}">
                                      </h:commandButton> <h:commandButton id="update" value="Update"
                                              action="#{seamUserHome.update}" rendered="#{seamUserHome.managed}">
                                      </h:commandButton> <h:commandButton id="delete" value="Delete"
                                              action="#{seamUserHome.remove}" immediate="true"
                                              rendered="#{seamUserHome.managed}">
                                      </h:commandButton> <s:button propagation="end" id="cancel" value="Cancel"
                                              view="/seamUserList.xhtml">
                                      </s:button></div>
                              </rich:panel>
      
      
      
      
      
                      </h:form>













        • 1. Re: WARN:Cannot create Seam component, scope is not active: seamUserRoleList(CONVERSATION)
          paul.dijou

          Same problem for me (Topic), not found any solution yet.


          After a few investigations, it appears that when you submit you form from you SeamUserList, the h:dataTable will invoke the method in its value parameter (in your case #{seamUserList.resultList}) but during this invoke, the ConversationContext is not active (neither the PageContext fyi) and so the warning appears.


          In the h:dataTable, it's just a warning, but try using a rich:dataTable and, if your case is like mine, you will have the warning and your application crashing.


          I don't have any idea of the problem's reason, don't know how to correct it, thinking it's come from Seam Scope that I don't manage well... if someone has a solution, thanks to him.

          • 2. Re: WARN:Cannot create Seam component, scope is not active: seamUserRoleList(CONVERSATION)
            northbright

            Hi!


            Thnx for the reply.


            I think my conversation end page context do exist when I invoke the


            #{seamUserList.resultList}

            but they somehow disappear, when I try to persist any object. I debugged it with a seam Conversational JavaBean (created it just for testing, put all the Page scoped Beans in it), so there was a conversational scope, but the persist() function did something...
            I have no idea where to look for any solution... at contexts reference guide, or at the view (jsf) guide? Any suggestion would be very appriciated!


            And again, thnx for Your reply Paul!