Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: NoSuchJobException: No job configuration with the name

  1. #11

    Default As requested: my job configuration

    Dave,

    Here is the configuration information for my job:

    Code:
    <batch:job id="myJob" job-repository="jobRepository">
      <batch:step id="updateTrackingInProcess" next="myStep">
        <batch:tasklet transaction-manager="transactionManager"
          ref="updateTrackingInProcessTasklet" />
      </batch:step>
      <batch:step id="myStep" next="updateTrackingCompleted">
        <batch:tasklet transaction-manager="transactionManager">
          <batch:chunk reader="myReader" processor="myProcessor" 
            writer="myWriter" commit-interval="100"/>
        </batch:tasklet>
      </batch:step>
      <batch:step id="updateTrackingCompleted">
        <batch:tasklet transaction-manager="transactionManager"
          ref="updateTrackingCompletedTasklet" />
      </batch:step>
    </batch:job>
    I can paste other elements here as needed, but the config entire is pretty big.

    Brian

  2. #12
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Nothing wrong with that. And you are using a JobRegistryBeanPostProcessor?

  3. #13

    Default JobRegistryBeanPostProcessor included

    Yes, here is the configuration for that. I also added my Job to a list so that it would be initialized as follows:

    Code:
    <util:list id="myJobs">
      <ref bean="myJob"/>
    </util:list>
        
    <bean id="jobRegistryBeanPostProcessor"
      class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
      <property name="jobRegistry" ref="jobRegistry" />
    </bean>
    Is there something else that I should be doing for that?

    Brian

  4. #14
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    The <util:list/> is not necessary in 2.0.2. Are you sure you got the right jars on your classpath? There is a test for this https://fisheye.springsource.org/bro...ext.xml?r=HEAD.

  5. #15

    Default More details, and yes, I'm sure.

    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

  6. #16
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Nothing jumps out at me. Is the JobRegistryBeanPostProcessor in the same ApplicationContext as the "myJob" bean? It wouldn't work if it was in a parent context and the job was in a child context for instance (you'd have to install the post processor in both).

  7. #17

    Default

    Yes, it's in the same app context as the 'myJob' bean (names may have been changed in postings here to protect the our competitive advantage ) .

    Brian

  8. #18
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Does it work if you put depends-on="myJob" in your JobDetailsBean definition? The reference to the Job is through a bean id in the JobDetails, not an actual reference, so that won't force it to actually be instantiated. As far as I can see it can still only go wrong if the Quartz job runs before the Job has been registered. Can you put a debug breakpoint in the JobRegistry (or the bean processor) and see if it actually being called (unfortunately there is no logging there)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •