3 Replies Latest reply on Apr 29, 2004 9:10 AM by Kees van Dieren

    EJB Timer Service

    sanjaymistry Newbie

      hi All,

      I have my ejbs deployed on jboss3.2.3

      I am trying touse EJB Timer service. Basically my bean looks like,
      public class TimerBean implements SessionBean, TimedObject {
      //all the standard methods here:
      public void ejbTimeout(Timer timer) {
      System.out.println("Oops......Timed out");
      }

      public void myCreateTimer(long intervalDuration) {
      System.out.println("TimerSessionBean: start createTimer ");
      TimerService timerService = context.getTimerService();
      Timer timer = timerService.createTimer(intervalDuration, "created timer");
      }

      }
      First of all, the jboss-j2ee.jar file which is there in default/lib (I have my ejb deployed in server/default) doesn't have javax.ejb.TimeObject interface and rest of the classes.
      Due to TimedObject and other classes not present I couldn't deploy my EJB. Then, I copied j2ee.jar file from j2ee1.4 which I downloaded from SUN. I could deploy the EJB but got the following error when I tried to access that method on EJB.

      Error:---------------------
      javax.ejb.EJBException: Unexpected Error
      java.lang.AbstractMethodError: org.jboss.ejb.StatelessSessionEnterpriseContext$SessionContextImpl.getTimerService()Ljavax/ejb/TimerService;
      at com.edgetrade.ejb.timer.TimerBean.myCreateTimer(Unknown Source)
      -------------------
      SoI think I can understand the AbstractMethodError problem. Jboss3.2.3 doesn't have latest implementation of those classes (those classes are absent from jar file).

      Which version of Jboss does support that ?

      Any help ?

        • 1. Re: EJB Timer Service
          Scott Stark Master

          Its not supported until the 4.0 release.

          • 2. Re: EJB Timer Service
            sanjaymistry Newbie

            Hi Scott,

            I installed JBoss4.0 and got error while execting the TimerService.

            Is there anything missing in Jboss4.0.

            I am posting this exception here, so if there are any problems with Jboss4.0 you can take a look into this.

            Here is the log from the screen:

            -----------------------------------------------------------------------------------
            2004-04-16 14:08:26,086 DEBUG [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] MBeanListener.handleNotification(), notification: javax.management.timer.TimerNotification: type=Schedule source=jboss:service=Timer sequence=1 time=1082138906072 message=Scheduler Notification id=1 userData=0
            2004-04-16 14:08:26,086 DEBUG [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] Scheduler is started: true
            2004-04-16 14:08:26,086 DEBUG [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] MBean Arguments are: [0, Fri Apr 16 14:08:26 EDT 2004]
            2004-04-16 14:08:26,086 DEBUG [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] MBean Arguments Types are: [java.lang.Integer, java.util.Date]
            2004-04-16 14:08:26,086 DEBUG [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] invoke(jboss:service=EJBTimerService, handleTimedEvent
            2004-04-16 14:08:26,086 DEBUG [org.jboss.ejb.timer.ContainerTimerService] handleTimedEvent(), this: org.jboss.ejb.timer.ContainerTimerService@1eaefc5, call timer: org.jboss.ejb.timer.ContainerTimer@1239780, container: org.jboss.ejb.StatelessSessionContainer@1af7a03
            2004-04-16 14:08:26,086 INFO [STDOUT] Oops......Timed out
            2004-04-16 14:08:26,086 DEBUG [org.jboss.ejb.timer.ContainerTimerService] cancel(), cancel timer: 0
            2004-04-16 14:08:26,086 DEBUG [org.jboss.ejb.timer.SchedulerTimerSource] Remove timer: 0, of container: jboss.j2ee:jndiName=TimerEjb,service=EJB
            2004-04-16 14:08:26,086 DEBUG [org.jboss.ejb.timer.FilePersistenceManager] remove(), container: jboss.j2ee:jndiName=TimerEjb,service=EJB, id: 0, timer list: {0=FilePersistenceManager.TimerItem [ , type: ADD, timer rep: ContainerTimerRepresentative [ Id: 0, key: null, start date: Fri Apr 16 14:08:26 EDT 2004, interval: single timer, info: created timer ] ]}, output: org.jboss.ejb.timer.FilePersistenceManager$MyObjectOutputStream@b910c6
            2004-04-16 14:08:26,086 INFO [org.jboss.ejb.timer.FilePersistenceManager] Write remove timer to file: FilePersistenceManager.TimerItem [ , type: REMOVE, timer rep: null ]
            2004-04-16 14:08:26,133 DEBUG [org.jboss.varia.scheduler.ScheduleManager$ScheduleInstance] stopSchedule(), notification id: 1
            2004-04-16 14:08:26,133 DEBUG [javax.management.timer.Timer] removeNotification: jboss:service=Timer,id=1
            2004-04-16 14:08:26,133 DEBUG [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] Remaining Repititions: 0, wait for next call to stop: false
            2004-04-16 14:08:26,133 DEBUG [org.jboss.varia.scheduler.ScheduleManager$ScheduleInstance] stopSchedule(), notification id: 1
            2004-04-16 14:08:26,133 ERROR [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] Handling a Scheduler call failed
            javax.management.ListenerNotFoundException: Listener not found org.jboss.varia.scheduler.ScheduleManager$MBeanListener@1bef4c6 for object name jboss:service=Timer
            at org.jboss.mx.notification.MBeanServerListenerRegistry.remove(MBeanServerListenerRegistry.java:139)
            at org.jboss.mx.server.MBeanServerImpl.removeNotificationListener(MBeanServerImpl.java:603)
            at org.jboss.varia.scheduler.ScheduleManager$ScheduleInstance.stop(ScheduleManager.java:835)
            at org.jboss.varia.scheduler.ScheduleManager$MBeanListener.handleNotification(ScheduleManager.java:612)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138)
            at $Proxy9.handleNotification(Unknown Source)
            at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:98)
            at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:83)
            at javax.management.timer.Timer.sendNotifications(Timer.java:496)
            at javax.management.timer.Timer.access$100(Timer.java:32)
            at javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:666)
            at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:175)
            at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:238)
            2004-04-16 14:08:26,133 DEBUG [javax.management.timer.Timer] remove: RegisteredNotification: [timer=jboss:service=Timer,id=1,startDate=Fri Apr 16 14:08:26 EDT 2004,periode=0,occurences=1,nextDate=Wed Dec 31 19:00:00 EST 1969]


            -----------------------------------------------------------------------------------

            • 3. Re: EJB Timer Service
              Kees van Dieren Newbie

              I got the same error, and also opened a topic some weeks ago @ http://www.jboss.org/index.html?module=bb&op=viewtopic&t=47728