Quartz Resourceadapter: Quartz with JDBC-Jobstore (required for Clustering) leads to NPE
in QuartzJob
-----------------------------------------------------------------------------------------------------
Key: EJBTHREE-836
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-836
Project: EJB 3.0
Issue Type: Bug
Reporter: Dieter Rehbein
Attachments: ejb3tests.jar, quartz-ds.xml, quartz.properties
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 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. 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
6. 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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira