1 Reply Latest reply on Feb 14, 2008 12:41 PM by dthibau1

    Sending email asynchronously

    dthibau1

      Hello everybody,

      My config :
      Jboss 4.2.1GA
      Seam 2.0.1

      I'm trying to send email asynchronously from a Seam Component like this :

      asynchroneNotifier.scheduleSendCR( 1000, selectedCR, server.toString());
      


      asynchroneNotifier is another SeamComponent :
      @Name("asynchroneNotifier")
      @AutoCreate
      public class AsynchroneNotifier {
      
       @In
       EntityManager entityManager;
      
       @Logger
       private Log log;
      
       @Asynchronous
       @TransactionAttribute(value=TransactionAttributeType.NOT_SUPPORTED)
       public void scheduleSendCR(@Duration
       long delay, CR cr, String server) {
      
       cr = entityManager.find(CR.class,cr.getId());
       for (Account a : cr.getDestinataires()) {
       Contexts.getEventContext().set("cr", cr);
       Contexts.getEventContext().set("sender", cr.getAuteur());
       Contexts.getEventContext().set("receiver", a);
       Contexts.getEventContext().set("server", server);
       try {
       Renderer.instance().render("/mail/envoiCRMail.xhtml");
       } catch (FacesException e) {
       e.printStackTrace();
       log.error(" Impossible d'envoyer la notification de CR Ã "+a.getNomComplet(), e);
       }
      
       }
       }
      
      }
      
      


      This code used to work fine with Seam 1.2 and JBoss 4.0.5. But with my
      new config, I encounter classpath problem.
      This occurs when Seam tries to create a MockFacesContext.

      Here is the trace log :

      20:11:44,337 ERROR [TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory


      Did I code something badly or is it a bug ?

      Thanks in advance