4 Replies Latest reply on Apr 14, 2009 5:00 PM by Cody Lerum

    Exception with seam mail delivery, not asynchronously!

    Swen Vogel Newbie


      i am new to seam, and trying to code a little online survey with email confirmation. I always get the following exception on rendering the email page (emailConfirmation.xhtml).

      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.ui.facelet.facesContextFactory
      Caused by: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

      I already googled for this exception and find some related post's. But the majority of the post's refer to
      asynchronous mail processing. When i open the mail page from the browser everything works fine.

      When i deploy the project the component org.jboss.seam.ui.facelet.facesContextFactory is successfully installed.

      [Initialization] Installing components...
      [Component] Component: org.jboss.seam.ui.facelet.facesContextFactory, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.ui.facelet.RendererFacesContextFactory

      Developing environment:

      • Seam: 2.1.1.GA

      • JBossAs: 5.0.1.GA

      Here are the relevant code part's:

      The stateless session bean for handling survey actions

      I send the email in the finishSurvey() method.

      public class SurveyAction implements SurveyActionLocal {
           private EntityManager em;
           @In(create = true)
           private Renderer renderer;
           private List<Survey> surveys;
           @In(required = false)
           @Out(required = false)
           private Survey selectedSurvey;
           @Factory(value = "surveys")
           public void initSurveys() {
                surveys = em.createQuery("from Survey").getResultList();
           public String beginSurvey(String surveyName, String page) {
                selectedSurvey = new Survey();
                return page;
           public String continueTo(String page) {
                return page;
           public String finishSurvey() {
                selectedSurvey.setCreationDate(new Date());
                // Send a email confirmation
                return "/survey_end.xhtml";
           public String showSurvey() {
                return "/admin/show_survey.xhtml";
           public String saveSurvey() {
                selectedSurvey = em.merge(selectedSurvey);
                return "saved";
           public String deleteSurvey() {
                selectedSurvey = em.merge(selectedSurvey);
                selectedSurvey = null;
                surveys = null;
                return "deleted";

      The test confirmation email (emailConfirmation.xhtml)

      <m:message xmlns:m="http://jboss.com/products/seam/mail">
           <m:from name="vogel" address="vogel@test.de" />
           <m:to name="vogel">vogel@test.de</m:to>
           <m:subject>Survey email confirmation</m:subject>
           <m:body type="plain">
                test message

      Thank's for your help ...