Migrating from JBoss 5.1 to JBoss 6.0: problems with scheduler
kirillica May 27, 2011 9:14 AMI have working in JBoss 5.1 application and need migrate it to JBoss 6.0. Additional to EJB binding problems (described here: http://community.jboss.org/thread/167258) I've got weird behavior of working scheduler:
With config in jboss-services.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=DistanceCalculationSchedule">
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableMBean">jboss.j2ee:ear=MyApplication.ear,jar=MyBusiness.jar,name=TaskToSchedule,service=EJB3,type=ManagementInterface
</attribute>
<attribute name="SchedulableMBeanMethod">perform</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="InitialRepetitions">-1</attribute>
<attribute name="SchedulePeriod">600000</attribute>
<depends>
<mbean code="javax.management.timer.Timer" name="jboss:service=Timer" />
</depends>
</mbean>
</server>
Scheduled bean:
@Management(TaskToScheduleMBean.class)
@Service(name = "TaskToSchedule")
public class TaskToSchedule extends ServiceMBeanSupport implements TaskToScheduleMBean
Interface:
public interface TaskToScheduleMBean extends ServiceMBean
Startup shows:
15:42:17,030 ERROR [org.jboss.varia.scheduler.Scheduler$BaseListener] Invoke failed for jboss.j2ee:ear=MyApplication.ear,jar=MyBusiness.jar,name=TaskToSchedule,service=EJB3,type=ManagementInterface perform: javax.management.InstanceNotFoundException: jboss.j2ee:ear=MyApplication.ear,jar=MyBusiness.jar,name=TaskToSchedule,service=EJB3,type=ManagementInterface is not registered.
at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:529) [:6.0.0.GA]
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:664) [:6.0.0.GA]
at org.jboss.varia.scheduler.Scheduler$MBeanListener.invoke(Scheduler.java:1316) [:6.0.0.Final]
at org.jboss.varia.scheduler.Scheduler$BaseListener.handleNotification(Scheduler.java:1235) [:6.0.0.Final]
at sun.reflect.GeneratedMethodAccessor236.invoke(Unknown Source) [:1.6.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_21]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_21]
at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:154) [:6.0.0.GA]
at $Proxy89.handleNotification(Unknown Source) at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:257) [:1.6.0_21]
at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(NotificationBroadcasterSupport.java:322) [:1.6.0_21]
at javax.management.NotificationBroadcasterSupport$1.execute(NotificationBroadcasterSupport.java:307) [:1.6.0_21]
at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:229) [:1.6.0_21]
at javax.management.timer.Timer.sendNotification(Timer.java:1237) [:1.6.0_21]
at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1206) [:1.6.0_21]
at javax.management.timer.TimerAlarmClock.run(Timer.java:1289) [:1.6.0_21]
at java.util.TimerThread.mainLoop(Timer.java:512) [:1.6.0_21]
at java.util.TimerThread.run(Timer.java:462) [:1.6.0_21]