6 Replies Latest reply on May 22, 2007 8:44 PM by bobbarkermtl

    Mail sending error

    demetrio812

      Hi,
      I have this mail template:

      <m:message xmlns="http://www.w3.org/1999/xhtml"
       xmlns:m="http://jboss.com/products/seam/mail"
       xmlns:h="http://java.sun.com/jsf/html">
      
       <m:from name="Upload4Freedom" address="info@upload4freedom.com" />
       <m:to name="info">filocamo@demetrio.it</m:to>
       <m:subject>Message from Contact Form</m:subject>
      
       <m:body>
       <p>
       <h:outputText value="Name: #{ContactForm.name}" />
       <h:outputText value="E-mail: #{ContactForm.email}" />
       <h:outputText value="Message: #{ContactForm.msg}" />
       </p>
       </m:body>
      
      </m:message>
      


      and I'm trying to send it with this method:

       public void sendEmail()
       {
       try {
       renderer.render("/mailTemplate.xhtml");
       facesMessages.add("E-mail sent, thank you!");
       }
       catch (Exception e) {
       facesMessages.add("Email sending failed: " + e.getMessage());
       }
       }
      


      I also tried various combination of configuration in components.xml, like this:
      <mail:mail-session host="smtp.tiscali.it" port="25" debug="true" ssl="false" />
      


      or:

      <mail:mail-session host="smtp.tiscali.it" port="25" username="" password="" debug="true" ssl="false" />
      


      but the error I got is:
      No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions! If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml. A typical config looks like this; <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener>
      


      How can I solve this problem? I use the latest version of seam with JBoss AS.

      Thanks a lot!

      Demetrio Filocamo
      (filocamo@demetrio.it)


        • 1. Re: Mail sending error
          demetrio812

          Is there someone that can help me?

          thanks

          Demetrio Filocamo

          • 2. Re: Mail sending error
            susnet

            Do you have

            <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>

            in your web.xml ?

            • 3. Re: Mail sending error
              demetrio812

              Hi, thanks for the answer!

              Yes I have it, I generated the project using seam-gen and I'm using JBoss AS, this is my web.xml:

              <?xml version="1.0"?>
              <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
               <context-param>
               <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
               <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
               </context-param>
               <context-param>
               <param-name>org.ajax4jsf.SKIN</param-name>
               <param-value>black</param-value>
               </context-param>
               <!-- Facelets development mode (disable in production) -->
               <context-param>
               <param-name>facelets.DEVELOPMENT</param-name>
               <param-value>true</param-value>
               </context-param>
               <!-- JSF -->
               <context-param>
               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
               <param-value>client</param-value>
               </context-param>
               <context-param>
               <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
               <param-value>.xhtml</param-value>
               </context-param>
               <!-- Ajax4jsf (must come first!) -->
               <filter>
               <display-name>Ajax4jsf Filter</display-name>
               <filter-name>ajax4jsf</filter-name>
               <filter-class>org.ajax4jsf.Filter</filter-class>
               </filter>
               <filter>
               <filter-name>Seam Filter</filter-name>
               <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
               </filter>
               <filter-mapping>
               <filter-name>ajax4jsf</filter-name>
               <url-pattern>*.seam</url-pattern>
               </filter-mapping>
               <filter-mapping>
               <filter-name>Seam Filter</filter-name>
               <url-pattern>/*</url-pattern>
               </filter-mapping>
               <!-- Seam -->
               <listener>
               <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
               </listener>
               <!-- MyFaces -->
               <listener>
               <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
               </listener>
               <servlet>
               <servlet-name>Seam Resource Servlet</servlet-name>
               <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
               </servlet>
               <servlet>
               <servlet-name>Faces Servlet</servlet-name>
               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
               <servlet-mapping>
               <servlet-name>Seam Resource Servlet</servlet-name>
               <url-pattern>/seam/resource/*</url-pattern>
               </servlet-mapping>
               <servlet-mapping>
               <servlet-name>Faces Servlet</servlet-name>
               <url-pattern>*.seam</url-pattern>
               </servlet-mapping>
               <security-constraint>
               <display-name>Restrict raw XHTML Documents</display-name>
               <web-resource-collection>
               <web-resource-name>XHTML</web-resource-name>
               <url-pattern>*.xhtml</url-pattern>
               </web-resource-collection>
               <auth-constraint>
               <role-name>NONE</role-name>
               </auth-constraint>
               </security-constraint>
               <login-config>
               <auth-method>BASIC</auth-method>
               </login-config>
              </web-app>
              


              Demetrio Filocamo

              • 4. Re: Mail sending error
                susnet

                Have you configured mail-service.xml in /jboss/.../deploy ?

                Set debug = true in mail-service.xml and you will get some more debugging logs to help you.

                Have you included jboss-seam-mail.jar in both war-module /lib and ejb-module /lib ?

                • 5. Re: Mail sending error
                  demetrio812

                  Hi!
                  I also tried that but that the output debug:

                  11:56:22,968 INFO [MailSession] Creating JavaMail Session (out.virgilio.it:25)
                  11:56:22,968 INFO [STDOUT] DEBUG: setDebug: JavaMail version 1.4ea
                  11:56:22,968 INFO [MailSession] connected to mail server
                  


                  btw I don't think it is a JavaMail problem...I also use JavaMail in another Java program and it works from my workstation with the same settings...

                  Demetrio

                  • 6. Re: Mail sending error
                    bobbarkermtl

                    Hi,
                    I also have this issue. It used to work with seam 1.6, but now I always have the exception. I don't know what to do to resolve it and I cannot return back to 1.6.

                    Patrick