1 Reply Latest reply on Apr 2, 2010 12:37 AM by Shane Sarver

    ClassLoader failed to find Quartz JobListener

    Shane Sarver Newbie

      Description: I am trying to give the classloader that started the quartz service the ability
      to invoke a job listener that I deployed in test.ear.  When JBoss is started, the quartz service
      deployed uses the quartz JARs in the lib:


      $JBOSS_HOME/server/default/lib
      
      log4j-1.2.14.jar  
      mysql-connector-java-5.1.10-bin.jar  
      quartz-1.7.3.jar  
      quartz-jboss-1.7.3.jar




      Using: jboss-5.1.0.GA patched with jboss-ejb3-plugin-1.0.19-installer.jar


      Detail: When the quartz trigger fires, quartz tries to instantiate com.test.action.RemoteJobListener that is
      packaged in test.jar.   The following exception is produced:



      org.quartz.SchedulerException: JobListener 'com.test.action.RemoteJobListener' not found.




      Log:


      13:25:52,505 INFO  [STDOUT] Hibernate: 
          insert 
          into
              RemoteJob
              (active, enabled, failed, host_id, max, min, next, start, stop) 
          values
              (?, ?, ?, ?, ?, ?, ?, ?, ?)
      13:25:52,507 INFO  [STDOUT] ***PASSWORD HASH: Ss/jICpf9c9GeJj8WKqx1hUClEE=
      13:25:52,507 INFO  [STDOUT] ***PASSWORD HASH: Ss/jICpf9c9GeJj8WKqx1hUClEE=
      13:25:52,511 INFO  [RemoteJobHome] ***BEFORE: remoteJobManager.scheduleJob(remoteJob): remoteJob: com.test.model.RemoteJob[id=38, host=com.test.model.Host@a7cb71, enabled=true, active=false, failed=false, min=0, max=0, next=Mon Mar 01 12:00:00 PST 2010, start=Thu Apr 01 12:00:00 PST 2010, stop=Fri Apr 30 12:00:00 PDT 2010]
      13:25:52,610 INFO  [RemoteJobHome] *** AFTER: remoteJobManager.scheduleJob(remoteJob): remoteJob: com.test.model.RemoteJob[id=38, host=com.test.model.Host@a7cb71, enabled=true, active=false, failed=false, min=0, max=0, next=Thu Apr 01 12:00:00 PST 2010, start=Thu Apr 01 12:00:00 PST 2010, stop=Fri Apr 30 12:00:00 PDT 2010]
      13:25:53,105 INFO  [JobStoreCMT] Handling 1 trigger(s) that missed their scheduled fire-time.
      13:25:53,326 ERROR [ErrorLogger] Unable to notify JobListener(s) of Job to be executed: (Job will NOT be executed!). trigger= group00.trigger00 job= DEFAULT.38
      org.quartz.SchedulerException: JobListener 'com.test.action.RemoteJobListener' not found.
           at org.quartz.core.QuartzScheduler.buildJobListenerList(QuartzScheduler.java:1752)
           at org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzScheduler.java:1839)
           at org.quartz.core.JobRunShell.notifyListenersBeginning(JobRunShell.java:335)
           at org.quartz.core.JobRunShell.run(JobRunShell.java:173)
           at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
      




      $JBOSS_HOME/server/default/deploy/quartz-service.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
      
        <mbean code="org.quartz.ee.jmx.jboss.QuartzService"
            name="user:service=QuartzService,name=QuartzService">
      
          <!--
              Wait until the DataSources  deployed. This option
              ensures correct  deployment order at JBoss startup.
              Change the 'QuartzDS' to your datasource name.
              Important!==> this is NOT the JNDI name of the datasource.
              (JNDI name for it is set in a separate xxx-service.xml file). 
           -->
          <!-- <depends>jboss.jca:service=LocalTxCM,name=QuartzDS</depends> -->
          <depends>jboss.jca:service=DataSourceBinding,name=QuartzDS</depends> 
          <depends>jboss.jca:service=DataSourceBinding,name=QuartzNoTxDS</depends> 
          <!--
              Wait for the deployment of XA-DataSource (if u have one ;)
              The same as above, but for XA-compliant datasource.
              Uncomment if you need it.
          -->
          <!--
          <depends>jboss.jca:service=DataSourceBinding,name=QuartzDS-XA</depends> 
          -->
          <!--
          <depends>jboss.jca:service=XATxCM,name=QuartzDS-XA</depends>
          -->
      
          <!--
            JNDI name for locating Scheduler, "Quartz" is default.
          -->
          <attribute name="JndiName">Quartz</attribute>
      
          <!--
             Call Scheduler.start() only if requested. Most of the time this 
             should be true. In some special cases you may want to have 
             scheduler service available but not run the jobs (for example, 
             if you want to administer the jobs on a particular server, only).
             Default value is true.
          -->
           <attribute name="StartScheduler">true</attribute>
      
          <!--
            By default a Properties file named "quartz.properties" is
            loaded from the 'current working directory'. If that fails,
            then the "quartz.properties" file located (as a resource)
            in the org/quartz package is loaded. If you wish to use a
            file other than these defaults, you must either define the
            system property 'org.quartz.properties' to point to the
            file you want or set the PropertiesFile attribute. You
            may also specify the properties directly by setting the
            Properties attribute. You must use only one of these
            methods to specify the properties.
          -->
      
         <!--
            Initialize the SchedulerFactory with the contents
            of the Properties file with the given name.
          -->
          <!--
          <attribute name="PropertiesFile">quartz.properties</attribute>
          -->
      
          <!--
            Initialized the SchedulerFactory with the contents
            of the given Properties object.
          -->
          
          <attribute name="Properties">
            # Default Properties file for use by StdSchedulerFactory
            # to create a Quartz Scheduler Instance, if a different
            # properties file is not explicitly specified.
            #
      
            # org.quartz.scheduler.classLoadHelper.class = 
         
            org.quartz.scheduler.instanceName = JBossQuartzScheduler
            org.quartz.scheduler.rmi.export = false
            org.quartz.scheduler.rmi.proxy = false
            org.quartz.scheduler.xaTransacted = false
      
            org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
            org.quartz.threadPool.threadCount = 5
            org.quartz.threadPool.threadPriority = 4
      
            org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT
            org.quartz.jobStore.driverDelegateClass =  org.quartz.impl.jdbcjobstore.StdJDBCDelegate
            org.quartz.jobStore.dataSource = QUARTZ
            org.quartz.jobStore.nonManagedTXDataSource = QUARTZ_NO_TX
            org.quartz.jobStore.tablePrefix = QRTZ_
            org.quartz.dataSource.QUARTZ.jndiURL = java:/QuartzDS
            org.quartz.dataSource.QUARTZ_NO_TX.jndiURL = java:/QuartzNoTxDS
           
          </attribute>
          
      
        </mbean>
      
      </server>
      



      $JBOSS_HOME/server/default/deploy/quartz-ds.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
        <xa-datasource>
         <jndi-name>QuartzDS</jndi-name>
         <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
         <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/quartz</xa-datasource-property>
         <user-name>******</user-name>
         <password>****</password>
         <metadata>
                 <type-mapping>mySQL</type-mapping>
         </metadata>
        </xa-datasource>
        <no-tx-datasource>
          <jndi-name>QuartzNoTxDS</jndi-name>
          <connection-url>jdbc:mysql://localhost:3306/quartz</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>******</user-name>
          <password>*****</password>
          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
          <metadata>
             <type-mapping>mySQL</type-mapping>
          </metadata>
        </no-tx-datasource>
      </datasources>
      




      File: seam.quartz.properties
      
      org.quartz.scheduler.instanceName = Sched999
      org.quartz.scheduler.rmi.export = false
      org.quartz.scheduler.rmi.proxy = false
      org.quartz.scheduler.xaTransacted = false
      org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
      org.quartz.threadPool.threadCount = 5
      org.quartz.threadPool.threadPriority = 4
      org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT
      org.quartz.jobStore.driverDelegateClass =  org.quartz.impl.jdbcjobstore.StdJDBCDelegate
      org.quartz.jobStore.tablePrefix = QRTZ_
      org.quartz.jobStore.dataSource = QUARTZ
      org.quartz.dataSource.QUARTZ.jndiURL = java:/QuartzDS
      org.quartz.jobStore.nonManagedTXDataSource = QUARTZ_NO_TX
      org.quartz.dataSource.QUARTZ_NO_TX.jndiURL = java:/QuartzNoTxDS




      File: applcation.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns="http://java.sun.com/xml/ns/javaee" 
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
                   version="5">
          
         <display-name>test</display-name>
         
         <module>
            <web>
               <web-uri>test.war</web-uri>
               <context-root>/test</context-root>
            </web>
         </module>
         
         <module>
            <ejb>test.jar</ejb>
         </module>
         
         <!-- Seam and EL -->
         <module>
             <ejb>jboss-seam.jar</ejb>
         </module>    
          
      </application>





      Archive:  test.ear
       Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
      --------  ------  ------- ---- ---------- ----- --------  ----
             0  Stored        0   0% 2010-04-01 13:22 00000000  META-INF/
           102  Defl:N       89  13% 2010-04-01 13:22 611f18c9  META-INF/MANIFEST.MF
             0  Stored        0   0% 2010-04-01 13:22 00000000  lib/
           650  Defl:N      283  57% 2010-04-01 13:22 96fb28b2  META-INF/application.xml
           276  Defl:N      192  30% 2010-04-01 13:22 23257941  META-INF/jboss-app.xml
       1171493  Defl:N  1064836   9% 2010-04-01 13:22 3cf50da8  jboss-seam.jar
        116205  Defl:N   103989  11% 2010-04-01 13:22 d16ed36a  lib/antlr-runtime.jar
        188671  Defl:N   169560  10% 2010-04-01 13:22 14df902e  lib/commons-beanutils.jar
       4366956  Defl:N  4130652   5% 2010-04-01 13:22 02bd7230  lib/core.jar
        127170  Defl:N    92699  27% 2010-04-01 13:22 ac35f534  lib/drools-api.jar
       1158010  Defl:N  1049167   9% 2010-04-01 13:22 9d87d445  lib/drools-compiler.jar
       1790798  Defl:N  1600938  11% 2010-04-01 13:22 b33c55fb  lib/drools-core.jar
         47197  Defl:N    41413  12% 2010-04-01 13:22 f2deadcc  lib/drools-decisiontables.jar
         46140  Defl:N    40216  13% 2010-04-01 13:22 105e8aee  lib/drools-templates.jar
       2827451  Defl:N  2615323   8% 2010-04-01 13:22 0ab10533  lib/groovy-all.jar
        463412  Defl:N   404154  13% 2010-04-01 13:22 1c542069  lib/janino.jar
        134652  Defl:N   122225   9% 2010-04-01 13:22 51c19fad  lib/jboss-el.jar
        101589  Defl:N    91601  10% 2010-04-01 13:22 f073fceb  lib/jboss-seam-remoting.jar
        668249  Defl:N   607226   9% 2010-04-01 13:22 dd68dbd3  lib/jbpm-jpdl.jar
        608039  Defl:N   557546   8% 2010-04-01 13:22 d9c15b96  lib/mvel2.jar
        171921  Defl:N   144928  16% 2010-04-01 13:22 99e65814  lib/richfaces-api.jar
         42425  Defl:N    38299  10% 2010-04-01 13:22 803810a8  test.jar
       7027656  Defl:N  7015841   0% 2010-04-01 13:22 aa7a7460  test.war
      --------          -------  ---                            -------
      21059062         19891177   6%                            23 files




      Archive:  test.war
       Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
      --------  ------  ------- ---- ---------- ----- --------  ----
             0  Stored        0   0% 2010-04-01 13:22 00000000  META-INF/
           102  Defl:N       89  13% 2010-04-01 13:22 611f18c9  META-INF/MANIFEST.MF
             0  Stored        0   0% 2010-04-01 13:22 00000000  WEB-INF/
             0  Stored        0   0% 2010-04-01 13:22 00000000  WEB-INF/classes/
             0  Stored        0   0% 2010-04-01 13:22 00000000  WEB-INF/classes/stylesheet/
             0  Stored        0   0% 2010-04-01 13:22 00000000  WEB-INF/lib/
             0  Stored        0   0% 2010-04-01 13:22 00000000  img/
             0  Stored        0   0% 2010-04-01 13:22 00000000  layout/
             0  Stored        0   0% 2010-04-01 13:22 00000000  secure/
             0  Stored        0   0% 2010-04-01 13:22 00000000  stylesheet/
             0  Stored        0   0% 2010-04-01 13:22 00000000  useradmin/
           239  Defl:N      186  22% 2010-04-01 13:22 0094f09f  WEB-INF/classes/components.properties
         20658  Defl:N     2143  90% 2010-04-01 13:22 1ddb72fc  WEB-INF/classes/messages_bg.properties
          7870  Defl:N     1840  77% 2010-04-01 13:22 f804910b  WEB-INF/classes/messages_de.properties
          6203  Defl:N     1483  76% 2010-04-01 13:22 b2e6d2eb  WEB-INF/classes/messages_en.properties
          8776  Defl:N     1980  77% 2010-04-01 13:22 96798604  WEB-INF/classes/messages_fr.properties
          6711  Defl:N     1567  77% 2010-04-01 13:22 bcd92d37  WEB-INF/classes/messages_it.properties
          8091  Defl:N     1685  79% 2010-04-01 13:22 e3212f88  WEB-INF/classes/messages_tr.properties
          3672  Defl:N      868  76% 2010-04-01 13:22 38f6df8c  WEB-INF/classes/stylesheet/theme.xcss
          3920  Defl:N     1068  73% 2010-04-01 13:22 467c4ca1  WEB-INF/components.xml
          1175  Defl:N      434  63% 2010-04-01 13:22 25923f01  WEB-INF/faces-config.xml
        146108  Defl:N   129587  11% 2010-04-01 13:22 310229c4  WEB-INF/lib/commons-digester.jar
         28344  Defl:N    21439  24% 2010-04-01 13:22 2a5606cb  WEB-INF/lib/darkX.jar
         31709  Defl:N    22287  30% 2010-04-01 13:22 2e1d3825  WEB-INF/lib/glassX.jar
         16156  Defl:N    14260  12% 2010-04-01 13:22 a1627edd  WEB-INF/lib/jboss-seam-debug.jar
        123998  Defl:N   109028  12% 2010-04-01 13:22 7a0ac04c  WEB-INF/lib/jboss-seam-excel.jar
         55095  Defl:N    49332  11% 2010-04-01 13:22 2174b30d  WEB-INF/lib/jboss-seam-ioc.jar
         28261  Defl:N    25092  11% 2010-04-01 13:22 a7a300ae  WEB-INF/lib/jboss-seam-mail.jar
         85697  Defl:N    80722   6% 2010-04-01 13:22 3463698e  WEB-INF/lib/jboss-seam-pdf.jar
          6857  Defl:N     5846  15% 2010-04-01 13:22 e5b5ab84  WEB-INF/lib/jboss-seam-rss.jar
        294610  Defl:N   269625   9% 2010-04-01 13:22 fc447f0b  WEB-INF/lib/jboss-seam-ui.jar
        302352  Defl:N   272153  10% 2010-04-01 13:22 fe8ba837  WEB-INF/lib/jsf-facelets.jar
        772495  Defl:N   713554   8% 2010-04-01 13:22 54879ed5  WEB-INF/lib/jxl.jar
       1551810  Defl:N  1451727   6% 2010-04-01 13:22 d50d68b0  WEB-INF/lib/richfaces-impl.jar
       4160770  Defl:N  3731403  10% 2010-04-01 13:22 b1a680ad  WEB-INF/lib/richfaces-ui.jar
          2541  Defl:N      654  74% 2010-04-01 13:22 2b25747a  WEB-INF/pages.xml
          3746  Defl:N     1122  70% 2010-04-01 13:22 1518476d  WEB-INF/web.xml
      ...
      




      
      Archive:  test.jar
       Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
      --------  ------  ------- ---- ---------- ----- --------  ----
             0  Stored        0   0% 2010-04-01 13:22 00000000  META-INF/
           102  Defl:N       89  13% 2010-04-01 13:22 611f18c9  META-INF/MANIFEST.MF
             0  Stored        0   0% 2010-04-01 13:22 00000000  com/
             0  Stored        0   0% 2010-04-01 13:22 00000000  com/test/
             0  Stored        0   0% 2010-04-01 13:22 00000000  com/test/action/
             0  Stored        0   0% 2010-04-01 13:22 00000000  com/test/model/
           705  Defl:N      270  62% 2010-04-01 13:22 5cb0c3f6  META-INF/ejb-jar.xml
           597  Defl:N      280  53% 2010-04-01 13:22 fa5a8ae2  META-INF/orm.xml
          1183  Defl:N      491  59% 2010-04-01 13:22 ef8a2c81  META-INF/persistence.xml
          4473  Defl:N     2116  53% 2010-04-01 13:22 389cbaf5  com/test/action/RemoteJobListener.class
          2998  Defl:N     1418  53% 2010-04-01 13:22 b882376e  com/test/action/RemoteJobManager.class
      ...
      
          4052  Defl:N      556  86% 2010-04-01 13:22 388f007c  import.sql
             0  Defl:N        2   0% 2010-04-01 13:22 00000000  seam.properties
           723  Defl:N      273  62% 2010-04-01 13:22 99b657d4  seam.quartz.properties
          1171  Defl:N      388  67% 2010-04-01 13:22 3baec18a  security.drl
      --------          -------  ---                            -------
         81797            36207  56%                            46 files




        • 1. Re: ClassLoader failed to find Quartz JobListener
          Shane Sarver Newbie

          I found this article that addresses my issue, but it does not solve the problem:





          Classloading notes
          http://www.len.ro/2008/10/another-way-to-use-quartz-in-jboss/
          
          1. If you want for packaging reasons to store your Job definition (class) or make it access other classes in a ear and not the the ${jboss.server}/lib you need to make sure that your Quartz service starts (is deployed) after your ear. You can to this by editing the service definition:
          
          <server>
            <mbean code="org.quartz.ee.jmx.jboss.QuartzService"
          
                name="user:service=QuartzService,name=QuartzService">
          ...
                  <depends>jboss.j2ee:service=EARDeployment,url='xxx.ear'</depends>
          ...
          
          2. If you for packaging reasons to store you Job definition (class) or make it access other classes in a war then you should make sure that you understand the JBoss unified classloader which is completely unified now except for the tomcat part. In order to unify it completely then change the line:
          
          <attribute name="UseJBossWebLoader">false</attribute>