9 Replies Latest reply on Mar 19, 2007 2:55 PM by Pete Muir

    Mail rendering fails with MyFaces exception

    Christian Bauer Master

      I didn't touch that code in a while but it also didn't change, only continuous Seam CVS upgrades. I'm rendering an email template with m, h, and f namespaces:

      01:11:38,863 INFO [MailSession] Creating JavaMail Session (mail.bluewin.ch:25)
      01:11:38,866 INFO [MailSession] connected to mail server
      01:11:38,867 INFO [STDOUT] java.lang.IllegalStateException: 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-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>

      01:11:38,867 INFO [STDOUT] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
      01:11:38,867 INFO [STDOUT] at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:742)
      01:11:38,867 INFO [STDOUT] at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:509)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.JSF.renderChild(JSF.java:171)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.mail.ui.MailComponent.encode(MailComponent.java:50)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.mail.ui.MailComponent.encode(MailComponent.java:38)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.mail.ui.UIBody.encodeChildren(UIBody.java:33)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.JSF.renderChild(JSF.java:174)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.mail.ui.UIMessage.encodeChildren(UIMessage.java:151)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.JSF.renderChild(JSF.java:174)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
      01:11:38,867 INFO [STDOUT] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:117)
      01:11:38,868 INFO [STDOUT] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:64)
      01:11:38,868 INFO [STDOUT] at org.jboss.seam.wiki.core.action.UserHome.persist(UserHome.java:119)

      I have the MyFaces listener in web.xml. Before I dig any deeper, has anyone seen this before?

        • 1. Re: Mail rendering fails with MyFaces exception
          Gavin King Master

          What does your template look like?

          • 2. Re: Mail rendering fails with MyFaces exception
            Christian Bauer Master

             

            <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"
             xmlns:f="http://java.sun.com/jsf/core">
             <m:header name="X-Sent-From" value="JBoss Seam" />
             <m:from name="Wikii" address="do-not-reply@jboss.com" />
             <m:to name="#{userHome.instance.firstname} #{userHome.instance.lastname}">#{userHome.instance.email}</m:to>
             <m:subject>[Wiki] Registration Confirmation</m:subject>
             <m:body>
             <html>
             <body>
             <p>Hello #{userHome.instance.firstname} #{userHome.instance.lastname},</p>
            
             <p>
             you registered an account. You need to click the following link to confirm the validity of your e-mail address and to activate your account:</p>
            
             <h:outputLink value="#{globalPrefs.baseURL}/confirmRegistration.seam?activationCode=#{userHome.instance.activationCode}">Click this link to activate the account '#{userHome.instance.username}'</h:outputLink>
            
             </body>
             </html>
             <f:facet name="alternative">
             <h:outputText>
            Hello #{userHome.instance.firstname} #{userHome.instance.lastname},
            
            you registered an account. You need to use the following link to confirm the validity of your e-mail address and to activate your account:
            
            #{globalPrefs.baseURL}/confirmRegistration.seam?activationCode=#{userHome.instance.activationCode}
            
            
             </h:outputText>
             </f:facet>
             </m:body>
            </m:message>
            



            • 3. Re: Mail rendering fails with MyFaces exception
              Gavin King Master

              I dunno. I guess Pete will need to take a look.

              • 4. Re: Mail rendering fails with MyFaces exception
                Gavin King Master

                I just tested the wiki registration process, it all works for me, including the email.

                But diff seems to be broken:

                SEVERE: Error Rendering View[/docHistory.xhtml]
                javax.faces.el.EvaluationException: Exception while invoking expression #{wikiLinkResolver.resolveWikiLink}
                 at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
                 at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
                 at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
                 at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:106)
                 at org.jboss.seam.wiki.core.ui.WikiTextParser.linkTag(WikiTextParser.java:43)
                 at org.jboss.seam.text.SeamTextParser.link(SeamTextParser.java:1338)
                 at org.jboss.seam.text.SeamTextParser.plain(SeamTextParser.java:753)
                 at org.jboss.seam.text.SeamTextParser.line(SeamTextParser.java:684)
                 at org.jboss.seam.text.SeamTextParser.paragraph(SeamTextParser.java:341)
                 at org.jboss.seam.text.SeamTextParser.text(SeamTextParser.java:282)
                 at org.jboss.seam.text.SeamTextParser.startRule(SeamTextParser.java:169)
                 at org.jboss.seam.wiki.core.ui.UIWikiFormattedText.encodeBegin(UIWikiFormattedText.java:43)
                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
                 at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:130)
                 at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:107)
                 at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:78)
                 at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:383)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:53)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                 at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:613)
                Caused by: java.lang.NullPointerException
                 at org.jboss.seam.wiki.core.links.WikiLinkResolver.resolveWikiLink(WikiLinkResolver.java:133)
                 at sun.reflect.GeneratedMethodAccessor1415.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                 at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                 at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                 at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
                 at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
                 at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                 at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                 at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                 at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
                 at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
                 at org.jboss.seam.wiki.core.links.WikiLinkResolver_$$_javassist_181.resolveWikiLink(WikiLinkResolver_$$_javassist_181.java)
                 at sun.reflect.GeneratedMethodAccessor1414.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
                 ... 60 more


                • 5. Re: Mail rendering fails with MyFaces exception
                  Pete Muir Master

                  Christian, this is on the wiki example in CVS? Can you talk me through how to reproduce this?

                  • 6. Re: Mail rendering fails with MyFaces exception
                    Christian Bauer Master

                    Check it out, edit build.properties with your JBoss location, start the HSQL DB as described in README.txt, call 'ant deploy' and try to register an account on http://localhost:8080/wiki

                    • 7. Re: Mail rendering fails with MyFaces exception
                      Gavin King Master

                      Again, the mail sending is working fine for me in the wiki example.

                      • 8. Re: Mail rendering fails with MyFaces exception
                        Pete Muir Master

                        Works fine for me too (well, I get an error connecting to that host but...)

                        • 9. Re: Mail rendering fails with MyFaces exception
                          Pete Muir Master

                          Are you using a standard JBoss 4.0.5.GA install with myfaces under jsf-libs/