5 Replies Latest reply on Jan 5, 2009 3:30 PM by fpsdyl

    Asynchronous calls to session beans..

    fpsdyl

      Hi All!,


      I am trying to access a statefull session bean from a asynchronous call with no luck whatsoever, here is my code :


      
      @Name("emailService")
      @AutoCreate
      public class EmailService{
          @Logger Log log;
      
          @In(create=true)
          Renderer renderer;
          
          @In(create=true,value="authenticator")
          Authenticator authenticator;
      
          public void sendMail(){
               log.info("=============================================");
              log.info("Sending mail asynchronously!!!!!");
              log.info("=============================================");
              authenticator.getUsers();
              Contexts.getEventContext().set("eList", users);
              renderer.render("/statsEmailReport.xhtml");
          }
      
      



      Here is the bean i am trying to access :


      
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("authenticator")
      @AutoCreate
      public class Authenticator implements AuthenticatorLocal,Serializable
      {
          @Logger Log log;
          @In Credentials credentials;
      
          @PersistenceContext
          EntityManager em;
      
          @Out(required=false)
          List<User_E> emailUsers;
      
      



      Now the thing is that authenticator in EmailServices resolves to null.. I have even tried not bijecting but using something like this :


      
      Authenticator authenticator = (Authenticater) Contexts.getSessionContext().get("authenticator");
      
      



      And that won't work either... I am seriously ready to start crying. Please if any one can help , I would greatly appreciate it - Thanks.