4 Replies Latest reply on Jun 26, 2006 8:19 PM by lpmon

    Scheduler Issue on AS4.0.3RC1?

      I'm stumped. I've had some scheduled classes running fine until recently. Maybe I've messed something up, but...

      In the logs, it appears that JBoss can't find the classes. I've confirmed, they're in /src/com/.... exactly like the scheduler-service.xml states:

      <mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=InventoryScheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">com.imc.scheduled.InventoryAvailabilityHandler</attribute>
       <attribute name="SchedulableArguments">17,US,dontusethis@myfakeaccount.orgt,false</attribute>
       <attribute name="SchedulableArgumentTypes">int,java.lang.String,java.lang.String,boolean</attribute>
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="SchedulePeriod">86400000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       </mbean>


      My class contains:
      package com.imc.scheduled;
      ...
      public class InventoryAvailabilityHandler implements Schedulable {
       protected int companyID;
       protected String countryCd;
       protected Address[] mailTo = null;
       protected boolean debug = true;
      
       /**
       * <p>Contructor that loads the parameters for the scheduled object.</p>
       *
       * <p>To control the parameters for this report, refer to the file
       * scheduler-service.xml in the deploy directory.</p>
       *
       * @param companyid the company identifier
       * @param countryCd the number of top vendors to include in the report
       * @param mailToList the string, pipe (|) delimited, of all persons that are to receive this eReport
       */
       public InventoryAvailabilityHandler(int companyID, java.lang.String countryCd, java.lang.String mailToList, boolean debug) {
       super();
      
      ...


      4 parameters, that match the content.

      Here are some significant snippets from the server.log:

      15:59:04,532 INFO [Scheduler] Failed to find: com.imc.scheduled.InventoryAvailabilityHandler
      java.lang.ClassNotFoundException: No ClassLoaders found for: com.imc.scheduled.InventoryAvailabilityHandler
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:198)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at org.jboss.varia.scheduler.Scheduler.setSchedulableClass(Scheduler.java:505)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.AttributeDispatcher.invoke(AttributeDispatcher.java:121)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:88)
      at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:61)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:442)
      at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:593)
      at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:568)
      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:273)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:162)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:116)
      at org.jboss.system.ServiceController.install(ServiceController.java:202)
      at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy4.install(Unknown Source)
      at org.jboss.deployment.SARDeployer.create(SARDeployer.java:220)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:919)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:773)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
      at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:483)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)

      ... and ....

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss:service=GINInventoryScheduler
      State: FAILED
      Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@f30c34 on mbean jboss:service=InventoryScheduler; - nested throwable: (java.security.InvalidParameterException: Given class com.imc.scheduled.InventoryAvailabilityHandler is not not found)


      I'm quite puzzled. Has behavior changed?

      Any thoughts on what's happening?

      I'm running JBoss AS 4.0.3RC1 on a PowerBook using OS X 10.4 and JSE 5.01

      Appreciate anyone's input - I've been looking at this for 2 days.

      Larry

        • 1. Re: Scheduler Issue on AS4.0.3RC1?

          BTW - what's really weird about this - everything else works fine - just the scheduled objects it can't find. All other classes referenced from the JSP pages work fine. I've tried deploying both as exploded and packaged war files, no difference. And in the exploded WAR, I've verified that the com.imc.scheduled.InventoryAvailabilityHandler.class is there, just as you'd expect, under the WEB-INF/classes directory.

          • 2. Re: Scheduler Issue on AS4.0.3RC1?
            genman

            4.0.3 changed something so that your JBoss services can't get access to classes in your .war file. There's probably something about this. The best solution would be to repackage as an .ear, put the common classes in a .jar, and share them using a common classloader.

            • 3. Re: Scheduler Issue on AS4.0.3RC1?

              That seems to be a true statement.

              Consider the following simple test case:

              import org.jboss.varia.scheduler.Schedulable;
              
              public class TestScheduler implements Schedulable {
               public TestScheduler() {
               super();
               }
              
               public void perform(java.util.Date date, long param) {
               try {
               System.out.println("calling TestScheduler");
               }
               catch (Exception e) {
               System.out.println("Exception " + e.getLocalizedMessage());
               e.printStackTrace();
               }
               }
              }
              

              with the following in scheduler-services.xml:

               <mbean code="org.jboss.varia.scheduler.Scheduler"
               name=":service=TestScheduler">
               <attribute name="StartAtStartup">true</attribute>
               <attribute name="SchedulableClass">TestScheduler</attribute>
               <attribute name="InitialStartDate">NOW</attribute>
               <attribute name="SchedulePeriod">1000</attribute>
               <attribute name="InitialRepetitions">1</attribute>
               </mbean>
              

              Saving (deploying) the scheduler-services.xml file results in:

              --- MBeans waiting for other MBeans ---
              ObjectName: jboss:service=TestScheduler
              State: FAILED
              Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@6bd255 on mbean jboss:service=TestScheduler; - nested throwable: (java.security.InvalidParameterException: Given class TestScheduler is not not found)

              --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
              ObjectName: jboss:service=TestScheduler
              State: FAILED
              Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@6bd255 on mbean jboss:service=TestScheduler; - nested throwable: (java.security.InvalidParameterException: Given class TestScheduler is not not found)


              which implies to me there's most likely a class loader issue, or that the Scheduler is deprecated.

              So - I'm really confused. We have some fairly simple schedule operations where the Scheduler has worked well. Is the scheduler deprecated? Is this a bug? Should we be using Quartz or similar products?





              • 4. Re: Scheduler Issue on AS4.0.3RC1?
                lpmon

                Anyone solve this? I am seeing it in 4.0.4.GA.

                How do I tell the scheduler the class in in my web app?