11 Replies Latest reply on Sep 10, 2008 9:06 PM by Vineet Manohar

    Seam Mail-works in synchronous event, error in asynchronous event or servlet

    Przemyslaw Jaskierski Newbie

      Environment: Seam 2.0.1 and 2.0.2-SNAPSHOT from 13 feb, plain Tomcat 6.0.


      I try to send an email from one of services. The same code:


      renderer.render(/WEB-INF/emailTemplates/test.xhtml);


      invoked from application-scoped component with method annotated as @Observer(foo)


      1. works when a synchronous event is invoked in JSF action
      using Events.instance().raiseEvent(foo)


      2. fails when invoked using Events.instance().raiseAsynchronousEvent(foo) from the same JSF action


      3. fails when invoked as both synchronous and asynchronous events from custom servlet bound with web:context-filter.


      Case 2. and 3. both lead to this exception:


      java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
           at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:267)
           at org.jboss.seam.mock.MockFacesContext.<init>(MockFacesContext.java:60)
           at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.init(FaceletsRenderer.java:95)
           at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.run(FaceletsRenderer.java:77)
           at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:169)




      I need to send this email from a service invoked by this custom servlet. How can I accomplish this with Seam-Mail?



      TIA