Announcement Announcement Module
Collapse
No announcement yet.
Batch: incrementer doesn't work for quartz job Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch: incrementer doesn't work for quartz job

    Incrementer works for regular launch from Spring Batch Admin console any number of times but it doesn't work for the same job using quartz.

    [INFO ] [2010-12-02 12:46:29,558] [org.springframework.batch.core.launch.support.Simp leJobLauncher] - Job: [FlowJob: [name=scbcideptJob]] completed with the following parameters: [{run.id=9}] and the following status: [COMPLETED]

    [INFO ] [2010-12-02 12:46:57,916] [org.springframework.beans.factory.xml.XmlBeanDefin itionReader] - Loading XML bean definitions from scbcideptCronJob.xml
    [INFO ] [2010-12-02 12:46:57,963] [org.springframework.beans.factory.xml.XmlBeanDefin itionReader] - Loading XML bean definitions from class path resource [jobs/scbcideptJob.xml]

    [INFO ] [2010-12-02 12:46:58,631] [org.quartz.simpl.RAMJobStore] - RAMJobStore initialized.
    [INFO ] [2010-12-02 12:46:58,631] [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler 'org.springframework.scheduling.quartz.SchedulerFa ctoryBean#0' initialized from an externally provided properties instance.
    [INFO ] [2010-12-02 12:46:58,631] [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler version: 1.5.2
    [INFO ] [2010-12-02 12:46:58,631] [org.quartz.core.QuartzScheduler] - JobFactory set to: org.springframework.scheduling.quartz.AdaptableJob Factory@fce051
    [INFO ] [2010-12-02 12:46:58,632] [org.springframework.context.support.DefaultLifecyc leProcessor] - Starting beans in phase 2147483647
    [INFO ] [2010-12-02 12:46:58,632] [org.springframework.scheduling.quartz.SchedulerFac toryBean] - Starting Quartz Scheduler now
    [INFO ] [2010-12-02 12:46:58,632] [org.quartz.core.QuartzScheduler] - Scheduler org.springframework.scheduling.quartz.SchedulerFac toryBean#0_$_NON_CLUSTERED started.
    [INFO ] [2010-12-02 12:46:58,661] [org.springframework.integration.handler.LoggingHan dler] - Registered jobs: [scbcideptJob]
    [INFO ] [2010-12-02 12:47:00,042] [org.springframework.batch.sample.quartz.JobLaunche rDetails] - Quartz trigger firing with Spring Batch jobName=scbcideptJob
    [ERROR] [2010-12-02 12:47:00,935] [org.springframework.batch.sample.quartz.JobLaunche rDetails] - Could not execute job.
    org.springframework.batch.core.repository.JobResta rtException: JobInstance already exists and is not restartable
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:97)
    at org.springframework.batch.sample.quartz.JobLaunche rDetails.executeInternal(JobLauncherDetails.java:7 2)
    at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:86)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 03)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:520)

  • #2
    Hello,

    you can see the problem into you stacktrace :

    JobInstance already exists and is not restartable

    The job can be started only once. You need to create for every execution a new job instance and not simply try to relaunch the same job. Batch admin console create a new instance every time and don't try to restart same job.

    PS: for schedunling job have a look at task namespace of spring 3.x core. You will get something like

    <task:scheduled-tasks scheduler="scheduler">
    <task:scheduled ref="myBatchProcessorInvoker" method="invoke" cron="*/5 * 9-17 * * MON-FRI"/>
    </task:scheduled-tasks>

    and don't need all quartz configurations.

    Comment

    Working...
    X