3 Replies Latest reply on Jan 3, 2005 1:09 AM by genman

    java.lang.ClassNotFoundException: No ClassLoaders found

    bwtoh

      I have this in /usr/local/jboss/server/cirebon/deploy/scheduler-service.xml

       <mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=Scheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">com.xxx.TS</attribute>
       <attribute name="SchedulableArguments"></attribute>
       <attribute name="SchedulableArgumentTypes"></attribute>
       <attribute name="InitialStartDate">0</attribute>
       <attribute name="SchedulePeriod">30000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       </mbean>
      

      But when I startup JBoss I encountered this error.
      2004-12-30 17:21:43,110 INFO [org.jboss.varia.scheduler.Scheduler]
      Failed to find: com.xxx.Text2SMS
      java.lang.ClassNotFoundException: No ClassLoaders found for:
      com.xxx.TS
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:161)
      

      I extracted the ear and confirmed that my new java class :
      com/xxx/TS.class
      is in my ear along with the many other class files.

      All other files are able to load.


      My colleague informed me that
      I forgot the
      <depends>
      attribute. It complain the class is not there
      because the ear/war/sar is not yet loaded by JBoss.


      I tried adding
      <depends>
      :
       <mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=Scheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">com.xxx.TS</attribute>
       <attribute name="SchedulableArguments"/>
       <attribute name="SchedulableArgumentTypes"/>
       <attribute name="InitialStartDate">0</attribute>
       <attribute name="SchedulePeriod">30000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       <depends>jboss.j2ee:service=EARDeployer</depends>
       </mbean>
      

      with values such as :
      <depends>module=aaa.jar,service=EjbModule</depends>
      <depends>service=EARDeployer</depends>
      

      But still face the same problem.
      The new class is in
      aaa.jar


      Pls help.

        • 1. Re: java.lang.ClassNotFoundException: No ClassLoaders found
          starksm64

          The depends tag does not handle class level dependencies. It only delays when services are started. In general you should not be using the deploy/scheduler-service.xml because of this. You should be adding a myscheduler-service.xml to your own deployments to ensure that the classes will be available.

          • 2. Re: java.lang.ClassNotFoundException: No ClassLoaders found
            bwtoh

            Dear Stark,

            Thanks for the reply.

            Are there any docs or manual where I can learn how to use a Schedulable class, schedule a service and solve my problem above ?

            Thanks again,
            bwtoh

            • 3. Re: java.lang.ClassNotFoundException: No ClassLoaders found
              genman

              I don't know if there are any docs for this specific case. But in short the lesson is this: Classes in your .ear are only available (usually I suppose) to components deployed from the .ear. Add a myscheduler.sar to your .ear, and add the .sar to your application.xml.

              Example in ant:

               <jar jarfile="${ear.dir}/myscheduler.sar">
               <manifest>
               <attribute name="Class-Path" value="lib/myclasses.jar"/>
               </manifest>
               <metainf dir="conf" includes="jboss-service.xml"/>
               </jar>