2 Replies Latest reply on Dec 14, 2009 6:52 PM by jeanluc

    Embedded JBoss and timer-based @Asynchronous implementations?

    jeanluc

      Has anyone been able to use <async:timer-service-dispatcher/> or <async:quartz-dispatcher/> and run the tests with the embedded JBoss?


      I've tried several things but keep getting:



      Caused by: java.lang.NullPointerException
           at org.jboss.seam.async.TimerServiceDispatcher.scheduleWithTimerService(TimerServiceDispatcher.java:94)
           at org.jboss.seam.async.TimerServiceDispatcher.scheduleInvocation(TimerServiceDispatcher.java:65)
           at org.jboss.seam.async.TimerServiceDispatcher.scheduleInvocation(TimerServiceDispatcher.java:37)



      The NPE occurs because in that dispatcher class,


      public class TimerServiceDispatcher extends AbstractDispatcher<Timer, TimerSchedule> implements LocalTimerServiceDispatcher{
         
         @Resource TimerService timerService;
      
      



      timerService is null.


      I checked the embedded JBoss JARs (as downloaded by Maven) for anything containing Timer, but only one one reference to the EJB2 timer service, but nothing about the EJB3 timer.


      I also tried to copy and adapt the ejb3-timerservice-jboss-beans.xml quoted below from a regular JBoss installation, but still no luck. By adapting I meant the need to change the package in which JBossTimerServiceFactory resides, which, for the embedded JBoss, is different: org.jboss.ejb3.timerservice.jboss instead of org.jboss.as.ejb3.timerservice



      <?xml version="1.0" encoding="UTF-8"?>
      <deployment xmlns="urn:jboss:bean-deployer:2.0">
         <bean name="JBossTimerServiceFactory" class="org.jboss.as.ejb3.timerservice.JBossTimerServiceFactory">
            <depends>jboss.ejb:service=EJBTimerService</depends>
         </bean>
      </deployment>



      Any suggestions are appreciated.
      Thanks,
      -jl

        • 1. Re: Embedded JBoss and timer-based @Asynchronous implementations?
          kapitanpetko

          I don't have the code here, but IIRC, it does work with Quartz. In tests I use RAMJobStore (production uses DB store).
          Since Quartz doesn't depend on the container, there should be no (major :)) problems.


          As for the timer services, no idea really. Try setting JBoss log levels to TRACE and see what happens on startup. If the timer services gets installed at all, you still may need to tweak the @Resource to get it injected (or xml files).


          • 2. Re: Embedded JBoss and timer-based @Asynchronous implementations?
            jeanluc

            That's the thing, the (EJB) timer service is not installed - and I haven't found any way to install it. The logs read:


            WARN  [org.jboss.ejb3.timerservice.jboss.JBossTimerServiceFactory] (main) TIMER SERVICE IS NOT INSTALLED



            Perhaps Embedded JBoss doesn't support it. I believe I got the same exception even when trying to use Quartz, but I should double-check. I'll get back on this when it comes on top of my pile.


            Thanks,
            -jl