7 Replies Latest reply on Sep 1, 2007 4:31 AM by robin.hultman

    Problem with Seam mail

    robin.hultman

      Im trying to send an email from an asynchronous method.

      @Asynchronous
      public QuartzTriggerHandle scheduleRaffle(@Expiration Date endDate, Season season, int raffleNo) {
      
       List<Subscription> winners = raffle2(season, raffleNo);
      
       try {
       Contexts.getEventContext().set("winner", winners.get(0));
       Subscription test = (Subscription)Contexts.getEventContext().get("winner");
      
       log.debug("###event context " + test.getEmail());
       renderer.render("/email/winner.xhtml");
       log.debug("Email sent successfully");
      
       } catch (Exception e) {
       log.debug("Email sending failed: " + e.getMessage());
       e.printStackTrace();
       }
      


      I see from my debug message that the winner variable is set correctly in the context.

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:s="http://jboss.com/products/seam/taglib"
       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:message>
      
       <m:from name="test" address="my email address goes here" />
       <m:to name="test">my email address goes here</m:to>
       <m:subject>testing</m:subject>
      
       <m:body>
       <p><h:outputText value="Hej" />,#{winner.email}</p>
       <p>some more text</p>
       </m:body>
      
       </m:message>
      </ui:composition>
      


      If I remove #{winner.email} everything works fine but when it is there I get NPE.

      2007-08-30 17:28:11,078 ERROR [STDERR] javax.el.ELException: /omx-cabin.war/email/winner.xhtml: null
      2007-08-30 17:28:11,078 ERROR [STDERR] at com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:50)
      2007-08-30 17:28:11,078 ERROR [STDERR] at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
      2007-08-30 17:28:11,078 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:172)
      2007-08-30 17:28:11,078 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
      2007-08-30 17:28:11,078 ERROR [STDERR] at org.jboss.seam.mail.ui.MailComponent.encode(MailComponent.java:80)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.mail.ui.MailComponent.encode(MailComponent.java:54)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.mail.ui.UIBody.encodeChildren(UIBody.java:44)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.mail.ui.UIMessage.encodeChildren(UIMessage.java:165)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:149)
      2007-08-30 17:28:11,093 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:113)
      2007-08-30 17:28:11,109 ERROR [STDERR] at com.omxgroup.lap.cabin.action.RaffleProcessor.scheduleRaffle(RaffleProcessor.java:69)
      2007-08-30 17:28:11,109 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2007-08-30 17:28:11,109 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2007-08-30 17:28:11,109 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2007-08-30 17:28:11,109 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2007-08-30 17:28:11,109 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      2007-08-30 17:28:11,109 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      2007-08-30 17:28:11,109 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      2007-08-30 17:28:11,109 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      2007-08-30 17:28:11,109 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.util.Work.workInTransaction(Work.java:39)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      2007-08-30 17:28:11,125 ERROR [STDERR] at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:42)
      2007-08-30 17:28:11,140 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      2007-08-30 17:28:11,140 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      2007-08-30 17:28:11,140 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
      2007-08-30 17:28:11,140 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
      2007-08-30 17:28:11,140 ERROR [STDERR] at com.omxgroup.lap.cabin.action.RaffleProcessor_$$_javassist_3.scheduleRaffle(RaffleProcessor_$$_javassist_3.java)
      2007-08-30 17:28:11,140 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2007-08-30 17:28:11,140 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2007-08-30 17:28:11,140 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2007-08-30 17:28:11,140 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:289)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      2007-08-30 17:28:11,156 ERROR [STDERR] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
      2007-08-30 17:28:11,156 ERROR [STDERR] Caused by: java.lang.NullPointerException
      2007-08-30 17:28:11,171 ERROR [STDERR] at com.sun.faces.el.ImplicitObjectELResolver.getValue(ImplicitObjectELResolver.java:74)
      2007-08-30 17:28:11,171 ERROR [STDERR] at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
      2007-08-30 17:28:11,171 ERROR [STDERR] at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
      2007-08-30 17:28:11,171 ERROR [STDERR] at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
      2007-08-30 17:28:11,171 ERROR [STDERR] at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
      2007-08-30 17:28:11,171 ERROR [STDERR] at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      2007-08-30 17:28:11,171 ERROR [STDERR] at com.sun.facelets.el.ELText$ELTextVariable.writeText(ELText.java:184)
      2007-08-30 17:28:11,171 ERROR [STDERR] at com.sun.facelets.el.ELText$ELTextComposite.writeText(ELText.java:108)
      2007-08-30 17:28:11,171 ERROR [STDERR] at com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:45)
      2007-08-30 17:28:11,171 ERROR [STDERR] ... 49 more
      


      Some help would be very appreciated.
      Thanks
      ~Robin