Dave,
I'll give you more detail on this, and perhaps that will help. First of all, I'm certain that I'm pointing at the right jars. This problem only appeared, however, when the Job was getting fired from a SchedulerFactoryBean via a CronTriggerBean. I think that changes how things are getting initialized.
Here is the config for those beans:
Code:
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="cronExpression" value="${spa.mw.cronexpression}" />
</bean>
</property>
<property name="waitForJobsToCompleteOnShutdown" value="true" />
</bean>
<bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com...JobLauncherDetails" />
<property name="group" value="spa-batch" />
<property name="jobDataAsMap">
<map>
<entry key="jobName" value="myJob"/>
<entry key="jobLocator" value-ref="jobRegistry"/>
<entry key="jobLauncher" value-ref="jobLauncher"/>
<entry key="fileWatcher" value-ref="myFileWatcher"/>
</map>
</property>
</bean>
And here is the code from my version of the JobLauncherDetails.
Code:
protected void executeInternal(JobExecutionContext context) {
JobParameters fileParameters = fileWatcher.run();
if (fileParameters != null) {
Map<String, Object> jobDataMap = context.getMergedJobDataMap();
String jobName = (String) jobDataMap.get(JOB_NAME);
log.debug("Quartz trigger firing with Spring Batch jobName="+jobName);
JobParameters jobParameters = getJobParametersFromJobMap(jobDataMap);
jobParameters = mergeParameters(jobParameters, fileParameters);
try {
jobLauncher.run(jobLocator.getJob(jobName), jobParameters);
} catch ( .. exception handling }
} else {
log.debug("File already processed");
}
}
Perhaps you can see something different here than what your test shows.
Brian