5 Replies Latest reply on Aug 11, 2004 1:19 PM by Scott Stark

    Scheduler - ClassNotFoundException

    Richard Karneim Newbie

      Hi all,

      the JBoss class loader cannot find my Scheduler class, even if I specify the jar containing the Scheduler class in the depends tag.
      I thought this would set the right deploy order between the service xml and the jar file.

      What else has to be done? Moving the stuff to the lib directory is not really a solution.

      Thank you for every hint.

      My scheduler-service.xml

      ..
      <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">mypackage.MyScheduler</attribute>
       <attribute name="SchedulableArguments">Schedulabe Test,12345</attribute>
       <attribute name="SchedulableArgumentTypes">java.lang.String,int</attribute>
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="SchedulePeriod">10000</attribute>
       <attribute name="InitialRepetitions">10</attribute>
       <depends>jboss.j2ee:module=myjar.jar,service=EjbModule</depends>
      </mbean>
      ..


        • 1. Re: Scheduler - ClassNotFoundException
          Larry Wilson Newbie

          Heard anything about this? I have exactly the same problem. We just upgraded to JBoss 3.2.5 and still experience the same behavior.

          Oddly, once we manually save the scheduler-service.xml file in the deploy directory after the server has started up, it works fine.

          • 2. Re: Scheduler - ClassNotFoundException
            netanelw Newbie

            Hi!

            Have solve the problem? from some reason the deploy of the jar is later then the deploy of scheduler-service.xml file and then the jboss cannot find the jar file on on hot redeploy of the xml file....

            anything new?

            • 3. Re: Scheduler - ClassNotFoundException
              Scott Stark Master

              The depends tag does not delay service creation. It only controls when the service life cycle events are dispatched. You cannot use depends to pick up classes from other deployments. The service definition should be placed into the ejb jar or enclosing ear rather than using the deploy/scheduler-service.xml.

              • 4. Re: Scheduler - ClassNotFoundException
                Larry Wilson Newbie

                OK - I'm confused. I have the same problem - my scheduled job I've created in my application won't start until the application is deployed. I get an error on initial load with [Scheduler] Failed to find: com.mycompany.MyScheduledJob.

                My question is - how do you get this to work - or what's the "best practices" alternative? Does this have to be created in a jar and placed in the lib directory (which seems weird)?

                Once the application has been loaded, I can update (resave) the scheduler-service.xml and things work just fine.

                Thanks for any pointers you can provide.
                Larry


                My scheduler-service.xml contains:

                 <mbean code="org.jboss.varia.scheduler.Scheduler"
                 name=":service=MyScheduledJob">
                 <attribute name="StartAtStartup">true</attribute>
                 <attribute name="SchedulableClass">com.mycompany.MyScheduledJob</attribute>
                 <attribute name="SchedulableArguments">test,123</attribute>
                 <attribute name="SchedulableArgumentTypes">int,int,java.lang.String</attribute>
                 <attribute name="InitialStartDate">NOW</attribute>
                 <attribute name="SchedulePeriod">1000</attribute>
                 <attribute name="InitialRepetitions">1</attribute>
                 </mbean>
                



                The error generated:

                java.lang.ClassNotFoundException: No ClassLoaders found for: com.mycompany.MyScheduledJob
                 at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:185)
                 at org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:178)
                 at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:132)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
                 at org.jboss.varia.scheduler.Scheduler.setSchedulableClass(Scheduler.java:549)
                 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:324)
                 at org.jboss.mx.server.AttributeDispatcher.dispatch(AttributeDispatcher.java:38)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                 at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:63)
                 at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:70)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                 at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:375)
                 at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:455)
                 at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:486)
                 at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:315)
                 at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:160)
                 at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:114)
                 at org.jboss.system.ServiceController.install(ServiceController.java:198)
                 at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:324)
                 at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                 at $Proxy4.install(Unknown Source)
                 at org.jboss.deployment.SARDeployer.create(SARDeployer.java:204)
                 at org.jboss.deployment.MainDeployer.create(MainDeployer.java:790)
                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:644)
                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
                 at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:324)
                 at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                 at $Proxy7.deploy(Unknown Source)
                 at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
                 at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:478)
                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java
                 at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
                 at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
                 at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
                 at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:324)
                 at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                 at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
                 at $Proxy0.start(Unknown Source)
                 at org.jboss.system.ServiceController.start(ServiceController.java:367)
                 at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:324)
                 at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                 at $Proxy4.start(Unknown Source)
                 at org.jboss.deployment.SARDeployer.start(SARDeployer.java:251)
                 at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:592)
                 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:324)
                 at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                 at $Proxy5.deploy(Unknown Source)
                 at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:407)
                 at org.jboss.system.server.ServerImpl.start(ServerImpl.java:311)
                 at org.jboss.Main.boot(Main.java:145)
                 at org.jboss.Main$1.run(Main.java:399)
                 at java.lang.Thread.run(Thread.java:534)
                




                • 5. Re: Scheduler - ClassNotFoundException
                  Scott Stark Master

                  Throw away the schedule-manager-service.xml and scheduler-service.xml files from deploy, and create your own sar that contains a META-INF/jboss-service.xml containing the Scheduler definition. You put your classes in the sar so that you have a self contained deployment. The sar can be a standard java archive or a directory structure.