8 Replies Latest reply on Jan 7, 2009 8:33 PM by tony.herstell1

    Seam Mail Problem NPE

    tony.herstell1

      Fail to get my email working asynch (very hard to debug!) again (tried this many months ago with no luck but now on Seam 2.1.1.GA and RF 3.2.2.SR1).


      Looked again at my non-asynch mail and noticed that an image that should have been there (it used to be!) was no longer there!


      <p>
           <h:graphicImage url="#{basePath}/images/sec_logo_sm.gif" />
      </p>



      This USED to work... with basePath defined in components.xml:


      <!-- Utility bean called "basePath"that allows the pages to reference the basePath for resources
      Usage: <link rel="stylesheet" type="text/css" href="#{basePath}/xmlhttp/css/xp/xp.css" />
           -->
      <factory name="basePath"
         value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}/" />
      



      Floundered in doco and found that adding urlBase into the m tag was supposed to help.. but it didn't...


      <m:message urlBase="#{basePath}">




      humm...


      Resported to:



      <p>
          <h:graphicImage url="http://www.selwynequestriancentre.co.nz/site/images/sec_logo_sm.gif" />
      </p>



      and this works again in non-asynch.



      aysnch still fails with NPE



      14:12:13,955 ERROR [STDERR] java.lang.NullPointerException
      14:12:13,955 ERROR [STDERR]      at javax.mail.internet.MimeUtility.checkAscii(MimeUtility.java:1286)
      14:12:13,955 ERROR [STDERR]      at javax.mail.internet.MimeUtility.encodeWord(MimeUtility.java:613)
      14:12:13,955 ERROR [STDERR]      at javax.mail.internet.MimeUtility.encodeText(MimeUtility.java:444)
      14:12:13,955 ERROR [STDERR]      at javax.mail.internet.MimeMessage.setSubject(MimeMessage.java:793)
      14:12:13,955 ERROR [STDERR]      at org.jboss.seam.mail.ui.UISubject.encodeChildren(UISubject.java:29)
      14:12:13,955 ERROR [STDERR]      at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
      14:12:13,955 ERROR [STDERR]      at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
      14:12:13,955 ERROR [STDERR]      at org.jboss.seam.mail.ui.UIMessage.encodeChildren(UIMessage.java:192)
      14:12:13,955 ERROR [STDERR]      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
      14:12:13,955 ERROR [STDERR]      at com.sun.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:50)
      14:12:13,955 ERROR [STDERR]      at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:357)
      14:12:13,955 ERROR [STDERR]      at com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:617)
      14:12:13,955 ERROR [STDERR]      at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
      14:12:13,955 ERROR [STDERR]      at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)




      based on:


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:repeat value="#{recipients}" var="eachRecipient" xmlns="http://www.w3.org/1999/xhtml"
           xmlns:m="http://jboss.com/products/seam/mail" xmlns:h="http://java.sun.com/jsf/html"
           xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets">
           <m:message urlBase="#{basePath}">
      
                <m:from name="Selwyn Equestrian Centre" address="tony.herstell@selwynequestriancentre.co.nz" />
      
                <s:fragment rendered="#{(eachRecipient.firstname ne null)}">
                     <m:to name="#{eachRecipient.firstname} #{eachRecipient.surname}">#{eachRecipient.email}</m:to>
                </s:fragment>
                
                <s:fragment rendered="#{(eachRecipient.firstname eq null)}">
                     <m:to>#{eachRecipient.email}</m:to>
                </s:fragment>
      
                <m:replyTo name="Selwyn Equestrian Centre" address="tony.herstell@selwynequestriancentre.co.nz" />
      
                <m:subject>#{subjectText}</m:subject>
      
                <m:body>
                     <table>
                          <tr>
                               <s:fragment rendered="#{!(eachRecipient.firstname eq null) or (eachRecipient.firstname eq '')}">
                                    <td width="50%" align="left">
                                         <h:outputText value="Dear #{eachRecipient.firstname}" />
                                    </td>
                               </s:fragment>
                               <s:fragment rendered="#{eachRecipient.avatar ne null}">
                                    <td width="50%" align="center">
                                         <m:attachment rendered="#{eachRecipient.avatar ne null}" value="#{eachRecipient.avatar.image}"
                                              fileName="#{eachRecipient.avatar.name}" contentType="#{eachRecipient.avatar.type}"
                                              status="avatar"
                                              disposition="inline" />
                                         <img src="cid:#{avatar.contentId}" />
                                    </td>
                               </s:fragment>
                          </tr>
                     </table>
                     
                     <p>
                          <s:formattedText value="#{messageText}"/>
                     </p>
      
                     <p>
                          <h:outputText value="#{messages.email_sec}" />
                     </p>
      
                     <center>
      
                          <hr/>
                                    
                          <p>
                               <h:graphicImage url="http://www.selwynequestriancentre.co.nz/site/images/sec_logo_sm.gif" />
                          </p>
           
                          <p>
                               <h:outputText value="#{messages.email_website_sec}" />
                          </p>
                          
                          <p>
                               <i>
                                    <h:outputText value="#{messages.mailing_list_remove_from_list}" />
                               </i>
                          </p>
                          
                          <hr/>
      
                     </center>
      
      
                </m:body>
           </m:message>
      </ui:repeat>




      Question 1.
      Is this a bug (why would basepath no longer work seems wrong to be adding in a full url)?



      Question 2.
      Why would the asynch throw a NPE.. whats the difference?






        • 1. Re: Seam Mail Problem NPE
          tony.herstell1

          I am still on JBoss 4.2.1.GA.


          No other software but Seam.

          • 2. Re: Seam Mail Problem NPE
            tony.herstell1

            from these changes:



            <m:message urlBase="http://www.selwynequestriancentre.co.nz">



            and



            <p>
                 <h:graphicImage url="/images/sec_logo_sm.gif" />
            </p>




            this is what was rendered...


            <p><img src="http://www.selwynequestriancentre.co.nz/project/images/sec_logo_sm.gif">
            </p>
            



            Where did project come from?


            Of course this is still not Asynch....

            • 3. Re: Seam Mail Problem NPE
              tony.herstell1

              Thinking laterally... I tried this:


              <p>
                 <h:graphicImage url="../images/sec_logo_sm.gif" />
              </p>




              bugger; I got this:


              <p><img src="http://../images/sec_logo_sm.gif">
              </p>
              


              • 4. Re: Seam Mail Problem NPE
                tony.herstell1

                Has anyone else successfully got asynch mail working with seam?

                • 5. Re: Seam Mail Problem NPE
                  tony.herstell1

                  Is anyone at all using seam mail in asynch mode at all?

                  • 6. Re: Seam Mail Problem NPE
                    etirk

                    Mailing using asynchronous (quartz) is not currently working. There is a jira filed on this, I cannot find it right now though.
                    It would seem that seam has a few issues regarding the quartz-integration, we have problems with this as well...mailing as well as other problems.


                    /K

                    • 7. Re: Seam Mail Problem NPE
                      etirk

                      Ah...here it is...
                      Your problem might be of another nature though...


                      SeamMailAgain


                      /K

                      • 8. Re: Seam Mail Problem NPE
                        tony.herstell1

                        Thanks for your reply Kristoffer.


                        I don’t think I am using Quartz.


                        I haven’t managed to get seam mail to work in asynch mode for a year now.


                        I mail to my mailing list and just wander away with the web page locked up... and watch the mails stack up in my send items in another tab (gmail)... when I see the last one go through I can then quit the browser... For all I know I could probably kill the browser once it hangs (I think I have done this once to no ill effect).


                        Anyhow.. I have seen this fixed a few times but, for me, it never seems to be fixed.


                        Reviewing the Doco and the mail example in the seam blob tells me that I am as close to the example as possible with my code (there is not actually much code to do is there!).


                        The seamsters are very busy with JSF2, Web Beans etc. so I am not too surprised things are taking a while to fix things (and answer forum questions) but it's all for the good!! and I dont actually pay for support so I must not complain.