Scheduler XMBean causing MalformedURLException: no protocol
zbeckman Mar 25, 2004 9:15 PMI've been having a terrible time getting an XMBean to function as a Schedulable service. The XMBean is just fine before I try to "upgrade" it to become Schedulable.
I have now added 'implements Schedulable' along with a 'perform()' method to the XMBean. It compiles just fine. I also changed the JMX declaration's 'code' parameter to point at the Scheduler, not at my class (I tried both ways, neither worked).
The bean is in its own SAR file using the following jboss-service.xml (the 'attribute' lines were added in order to make the Schedulable service work, but doing so causes exceptions. The service file is (currently):
<service> <mbean code="org.jboss.varia.scheduler.Scheduler" name="Importer:name=ImporterService" xmbean-dd="com/legaledge/harmony/ejb/beans/ImporterServiceBean.xml"> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass">com.legaledge.harmony.ejb.beans.ImporterServiceBean</attribute> <attribute name="InitialStartDate">NOW</attribute> <attribute name="SchedulePeriod">5000</attribute> <attribute name="InitialRepetitions">-1</attribute> <!--Importer service monitors and manages data load operations with external data sources.--> </mbean> </service>
I also tried using this:
<mbean code="com.legaledge.harmony.ejb.beans.ImporterServiceBean"...
But that doesn't work either. In each case, I get one of two exceptions:
The exception I'm getting in the former case:
(java.net.MalformedURLException: no protocol: com/legaledge/harmony/ejb/beans/ImporterServiceBean.xml))
at org.jboss.deployment.SARDeployer.create(SARDeployer.java:202)
...snip...
In the former case (with 'code' pointing at my MBean), I was also able to generate this kind of exception:
[ServiceConfigurator] Problem configuring service Importer:name=ImporterService
org.jboss.deployment.DeploymentException: No Attribute found with name: StartAtStartup
at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:334)
...snip...
(this was generated when setting the mbean class to my own class rather than the Scheduler class).
If anyone can assist with this I would very much appreciate it.
Following is a relevant snip of the code from the ImporterServiceBean:
public class ImporterServiceBean extends org.jboss.system.ServiceMBeanSupport implements Schedulable { /** * @jmx.managed-operation * description="Starts the importer service. This method is automatically invoked during server startup." */ public void start() throws Exception { bind(); isRunning = true; logger.info("Importer service started."); } /** * @jmx.managed-operation * description="Stops the importer service. This prevents any scheduled import tasks from running." */ public void stop() { unbind(); isRunning = false; logger.info("Importer service stopped."); } /** * @param now The time at which the service method was invoked. * @param remainingRepetitions The number of repetitions remaining (or -1 for infinite repetitions). */ public void perform(java.util.Date now, long remainingRepetitions) { beginImport(); } ...snip...