4 Replies Latest reply on Jun 13, 2007 7:39 AM by eric es

    async timed events and mailing

    eric es Newbie

      Hello All,

      I have a small problem with emailing from my application. If a user triggers an action in the web pages emailing works perfectly, however I also have a timed service running started on deployement, wich must run every day. I use a pojo controller wih basicly does this:

      @Name("notifierController")
      @Startup()
      @Scope(ScopeType.APPLICATION)
      public class NotifierController {
       @In(create = true)
       private Notifier notifier;
      
       @Create()
       public void start() {
       Timer nTimer = notifier.check(0, 24*60*60*1000);
       }
      }
      

      the Notifier object is a stateless session bean with the check() method in the interface:
      @Local()
      public interface Notifier {
       @Asynchronous()
       public Timer check(@Duration long d, @IntervalDuration long i);
      }
      

      From the bean implementation I try to send the email like this:
      @Stateless()
      @Name("notifier")
      public class NotifierBean implements Notifier {
       @In()
       private Timer timer;
      
       @In()
       private Renderer renderer;
      
       public Timer check(@Duration long d, @IntervalDuration long i) {
       try {
       this.renderer.render("/path/to/email.xhtml");
       } catch (Exception e) {
       e.printStackTrace();
       }
      
       return this.timer;
       }
      }
      

      The email component is properly configured as it works from interface-triggered bean methods, when this executes I get th exception:

      12:50:15,337 ERROR [STDERR] java.lang.UnsupportedOperationException
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.mock.MockApplication.createComponent(MockApplication.java:154)
      12:50:15,337 ERROR [STDERR] at com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:243)
      12:50:15,337 ERROR [STDERR] at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:139)
      12:50:15,337 ERROR [STDERR] at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
      12:50:15,337 ERROR [STDERR] at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
      12:50:15,337 ERROR [STDERR] at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:107)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:56)
      12:50:15,337 ERROR [STDERR] at my.package.Notifier.check(NotifierBean.java:20)
      12:50:15,337 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:50:15,337 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      12:50:15,337 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      12:50:15,337 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      12:50:15,337 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      12:50:15,337 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      12:50:15,337 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
      12:50:15,338 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      12:50:15,338 ERROR [STDERR] at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
      12:50:15,338 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      12:50:15,338 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
      12:50:15,338 ERROR [STDERR] at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
      12:50:15,338 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
      12:50:15,338 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      12:50:15,338 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      12:50:15,338 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      12:50:15,338 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)


      The email is text only, no calls to other components or whatsoever. Somebody knows what's the mistake I make?

      Thanks in advance,
      Eric