Problem singleton scheduling in a clustered JBoss 4.02 (java
kenshiro2000 Feb 4, 2009 7:47 AMHi,
I'm trying to schedule a singleton in an HA env. My application server is JBoss 4.0.2 in a cluster environment with 2 nodes. But I must say it is a much hard work to do! The documentation is not enough and I'm not so expert in JBoss and MBean realm.
I followed the examples in the JBoss develop guide but something doesn't work yet. And now I'm in trouble!
This is the code excerpt:
public class SchedulableService extends ServiceMBeanSupport implements SchedulableServiceMBean { public SchedulableService() { } public void run(String amb, int num, boolean gen) { Jobber.Run(amb, num, gen); } } public interface SchedulableServiceMBean extends ServiceMBean { public abstract void run(String amb, int num, boolean gen); }
Here is the jboss-service.xml file for the configuration of the SAR file:
<server> <mbean code="it.se.bt.comm.em.SchedulableService" name="jboss.schedule:service=HASchedulable"> </mbean> <mbean code="org.jboss.varia.scheduler.ScheduleManager" name="jboss:service=ScheduleManager"> <attribute name="StartAtStartup">true</attribute> </mbean> <mbean code="org.jboss.varia.scheduler.SingleScheduleProvider" name="jboss:service=HASingleScheduleProvider"> <depends>jboss:service=mypartition</depends> <depends>jboss:service=ScheduleManager</depends> <depends>jboss.schedule:service=HASchedulable</depends> <attribute name="PartitionName">mypartition</attribute> <attribute name="HASingleton">true</attribute> <attribute name="ScheduleManagerName">jboss:service=ScheduleManager</attribute> <attribute name="TargetName">jboss.schedule:service=HASchedulable</attribute> <attribute name="TargetMethod">run( TPD , 16 , true)</attribute> <attribute name="StartDate">NOW</attribute> <attribute name="Period">60000</attribute> <attribute name="Repetitions">-1</attribute> </mbean> </server>
When I deploy the SAR file I get this Exception:
2009-02-04 13:36:59,039 ERROR [org.jboss.varia.scheduler.ScheduleManager$MBeanListener] Invoke of the Schedulable MBean failed javax.management.ReflectionException at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:216) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at org.jboss.varia.scheduler.ScheduleManager$MBeanListener.handleNotification(ScheduleManager.java:593) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138) at $Proxy9.handleNotification(Unknown Source) at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:257) at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(NotificationBroadcasterSupport.java:322) at javax.management.NotificationBroadcasterSupport$1.execute(NotificationBroadcasterSupport.java:307) at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:229) at javax.management.timer.Timer.sendNotification(Timer.java:1237) at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1206) at javax.management.timer.TimerAlarmClock.run(Timer.java:1289) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Caused by: java.lang.IllegalArgumentException: Unable to find operation run(TPD,16,true) ... 17 more
I think the problem is related to the "TargetMethod" invokatio but I cannot understand what is wrong.
Does anyone have any idea about it?
thanks