[jboss-user] [Management, JMX/JBoss] - Schedulable & jboss-service.xml
rabbiaqaswar
do-not-reply at jboss.com
Sun Apr 20 10:21:50 EDT 2008
Hello
I am trying to use the Scheduler service provided by JBoss 4.2.2 GA. Here is how the scheduler-service in default/deploy directory looks like:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <server>
|
| <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler">
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableClass">org.schedular.MySchedular</attribute>
| <attribute name="SchedulableArguments">TheName,123456789</attribute>
| <attribute name="SchedulableArgumentTypes">java.lang.String,long</attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="SchedulePeriod">1000</attribute>
| <attribute name="InitialRepetitions">5</attribute>
| <depends>
| <mbean code="javax.management.timer.Timer"
| name="jboss:service=Timer"/>
| </depends>
| </mbean>
|
| </server>
|
and here is the Scheduler class:
| package org.schedular;
|
| import java.util.Date;
| import org.jboss.varia.scheduler.Schedulable;
|
| public class MySchedular implements Schedulable {
|
| private String name;
| private long value;
|
| public MySchedular(String name, long value) {
| this.name = name;
| this.value = value;
| System.out.println("ctor, name: " + name + ", value: " + value);
| }
|
| public void perform(Date now, long remainingRepetitions) {
| System.out.println("perform, now: " + now +
| ", remainingRepetitions: " + remainingRepetitions +
| ", name: " + name + ", value: " + value);
| }
| }
This MySchedular is part of an ejb-module of the application so I have to place it inside the jar file containing all the ejbs. Now the problem is that when i start JBoss it gives the following error:
| [Scheduler] Failed to find: org.schedular.MySchedular
| java.lang.ClassNotFoundException: No ClassLoaders found for: org.schedular.MySchedular
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss:service=Scheduler
| State: FAILED
| Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute at d006a7 on mbean jboss:service=Scheduler; - nested throwable: (java.security.InvalidParameterException: Given class org.schedular.MySchedular is not not found)
|
When the jar file containing MySchedular is deployed, JBoss deploys it successfully. But the perform method in MySchedular is not executed. Now while the server is running, i make any changes like add an empty line in the scheduler-service.xml and save it, MySchedular perform method is invoked showing:
| INFO [STDOUT] ctor, name: TheName,value: 123456789
| INFO [STDOUT] perform, now: Sun Apr 20 18:15:55 GST 2008, remainingRepetitions: 4, name: TheName,value: 123456789
| INFO [STDOUT] perform, now: Sun Apr 20 18:15:56 GST 2008, remainingRepetitions: 3, name: TheName,value: 123456789
| INFO [STDOUT] perform, now: Sun Apr 20 18:15:57 GST 2008, remainingRepetitions: 2, name: TheName,value: 123456789
| INFO [STDOUT] perform, now: Sun Apr 20 18:15:58 GST 2008, remainingRepetitions: 1, name: TheName,value: 123456789
|
I cannot understand what am I missing here, please see if you can help.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145341#4145341
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145341
More information about the jboss-user
mailing list