2 Replies Latest reply on Sep 24, 2009 6:56 PM by jmchiaradia

    Asynchronous mail

      Hello,
      I am trying to sen a mail using an Asynchronous methos:



             
      @Name("mailSender")
      public class MailSender {
      
              @In(create=true)
              Renderer renderer;
              
              @Asynchronous
              public void sendNewOutNoteNotification(OutNote outNote) {
                  try {
                     renderer.render("/mail/newOutNote.xhtml");
                 } catch (Exception e) {
                         e.printStackTrace();
                 }
              }
              
      }



      But I can't get it work, if I remove the @Asynchronous it works, but I need to do it in an Asynchronous way.


      Have any body do it? Could you help me?


      here is the stack trace of the error when I'm trying to send the mail:



      24/09/2009 11:25:19 org.jboss.seam.mail.MailSession createSession
      INFO: Creating JavaMail Session (smtp.gmail.com:25)
      24/09/2009 11:25:19 org.jboss.seam.mail.MailSession createSession
      INFO: connected to mail server
      java.lang.NullPointerException
              at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:873)
              at javax.mail.internet.InternetAddress.validate(InternetAddress.java:856)
              at org.jboss.seam.mail.ui.AddressComponent.getInternetAddress(AddressComponent.java:39)
              at org.jboss.seam.mail.ui.RecipientAddressComponent.encodeBegin(RecipientAddressComponent.java:25)
              at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:172)
              at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
              at org.jboss.seam.mail.ui.UIMessage.encodeChildren(UIMessage.java:192)
              at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
              at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
              at org.jboss.seam.ui.facelet.RendererRequest.renderFacelet(RendererRequest.java:136)
              at org.jboss.seam.ui.facelet.RendererRequest.run(RendererRequest.java:103)
              at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:43)
              at eds.notas.bean.MailSender.sendNewOutNoteNotification(MailSender.java:23)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
              at eds.notas.bean.MailSender_$$_javassist_seam_18.sendNewOutNoteNotification(MailSender_$$_javassist_seam_18.java)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
              at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62)
              at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80)
              at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44)
              at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)





      Regards,
      Chiara