5 Replies Latest reply on Jan 24, 2008 8:39 AM by Francis LIMOUSY

    Conversation Beans and Session scoped beans resulting in "Co

    Francis LIMOUSY Newbie

      Hello,

      I just had the "Could not find stateful Bean" error in my application.
      After searching in the forum, I finally understand that a bean with a wider scope (Session) kept a reference of the stateful bean that cannot be find by other sessions.

      Here is some snipplets of my code:


      The session-scoped bean

      @Scope(ScopeType.SESSION)
      @Name("gestionaffichage")
      public class GestionAffichageBean implements GestionAffichage
      



      The stateful bean

      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("activitesByCollaborateurCrossData")
      public class activitesByCollaborateurCrossDataBean implements activitesByCollaborateurCrossData
      
      
      bla bla bla ...
      
      
       @In
       public GestionAffichage gestionaffichage;
      
      
      yada yada ...
      
      
       public void setRealise()
       {
       this.realise = true;
       this.debut();
       gestionaffichage.afficherMenuActiviteParCollaborateur();
       }
      



      Since I add the "gestionaffichage" calls in my stateful bean, "Could not find stateful Bean" errors appeared.
      I temporary moved the scope of "gestionaffichage" to APPLICATION to avoid problems but it's not supposed to be shared between clients.

      My question is: why does this error happen ?

      I mean, I don't have a reference of my stateful bean in my session-scoped bean; I have the exact opposite: an injection of my session-scoped bean in the conversation.

      So I don't get how the error is supposed to happen.
      Can't I inject a "wider" scoped bean in my conversation ?
      I certainly missed something here but I don't know what ...

      Regards