Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-836

Quartz Resourceadapter: Quartz with JDBC-Jobstore (required for Clustering) leads to NPE in QuartzJob

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • None

    Description

      For our customer we need clustered quartz-timers. This requires a JDBC-Jobstore (see http://wiki.opensymphony.com/display/QRTZ1/TutorialLesson11).

      Using a JDBC-Jobstore leads to the following exception:

      16:46:40,046 ERROR [JobRunShell] Job default.job.0.1169048021109 threw an unhandled Exception:
      java.lang.NullPointerException
      at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:53)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

      This is what we've done:

      1. installed jBoss 4.0.5 GA with ejb3 clustered profile

      2. created a quartz.properties in directory <jboss-home>/server/default/conf (see attached file)

      3. added a quartz-ds.xml to <jboss-home>/server/default/deploy (using a mySQL-database) (see attached file)

      4. moved the file quartz-ra.rar from <jboss-home>/server/default/deploy to <jboss-home>/server/default/deploy/deploy.last (to ensure, that the JDBC-datasource is already bound to JNDI when the resource-adapater is deployed)

      5. added the mysql-JDBC-Driver to <jboss-home>/server/default/lib

      6. created the database-tables required by quartz using the script tables_mysql_innodb.sql (part of the quartz 1.5.2 distribution)

      7. created a simple test MDB (see attached files TestJob.java and ejb3test.jar) and deployed it to directory <jboss-home>/server/default/deploy/deploy.last

      8. started jBoss => you can see the NPE every 10 seconds

      I've debugged a little bit. This is, what I've found so far:

      • If a JobStoreTX is used as JobStore, the class JobStoreTX uses StdJDBCDelegate.insertJobDetail(..) to store the JobDetails in the database. The method insertJobDetail(...) serializes the JobDataMap into a ByteArrayOutputStream. The method endpointActivation(..) of class org.jboss.resource.adapter.quartz.inflow.QuartzResourceAdapter adds a reference to the MessageEndpointFactory to the JobDataMap (using the key "endpointFactory"). Since the MessageEndpointFactory is not serializable, the MessageEndpointFactory is not stored in the JDBC-Jobstore !
      • The method execute(...) of org.jboss.resource.adapter.quartz.inflow.QuartzJob retrieves the "endpointFactory" from the JobDataMap (which returns null, because it was not serialized). In line 53 the method createEndpoint(..) is called on a null-object => NPE

      Attachments

        1. ejb3tests.jar
          1 kB
        2. quartz.properties
          1 kB
        3. quartz-ds.xml
          1.0 kB
        4. TestJob.java
          1.0 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rehdie_jira Dieter Rehbein (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: