org.springframework.batch.core.launch.NoSuchJobException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I'm starting batch jobs with @Scheduled with fixedDelay. Since latest version the jobs fails as it has not been registered yet to the job repository. This is solved if I put a initialDelay to the annotation. So I assume there are some loader timing issues. Which may be critical for people also relying on @Scheduled with fixedDelay! {code} @Configuration public class BatchConfig { @Bean public ApplicationContextFactory myJob() { return new GenericApplicationContextFactory(MyJob.class); } } @Service public class RunnerClass { @Autowired private JobRegistry jobRegistry; @Autowired private JobLauncher jobLauncher; @Scheduled(fixedDelay = 30000) //fix: , initialDelay = 5000) public void runJob() throws Exception { //init Job job = jobRegistry.getJob(MyJob.class.getSimpleName()); jobLauncher.run(job, params); } } {code} Running without the initialDelay throws the following exception: {code} org.springframework.batch.core.launch.NoSuchJobException: No job configuration with the name [myJob] was registered at org.springframework.batch.core.configuration.support.MapJobRegistry.getJob(MapJobRegistry.java:66) ~[spring-batch-core-3.0.2.RELEASE.jar:3.0.2.RELEASE] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.1.3.RELEASE.jar:4.1.3.RELEASE] at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.1.3.RELEASE.jar:4.1.3.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_51] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [?:1.7.0_51] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [?:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51] {code} spring-boot-1.2.0.RELEASE
    via by member sound,
  • I'm starting batch jobs with @Scheduled with fixedDelay. Since latest version the jobs fails as it has not been registered yet to the job repository. This is solved if I put a initialDelay to the annotation. So I assume there are some loader timing issues. Which may be critical for people also relying on @Scheduled with fixedDelay! {code} @Configuration public class BatchConfig { @Bean public ApplicationContextFactory myJob() { return new GenericApplicationContextFactory(MyJob.class); } } @Service public class RunnerClass { @Autowired private JobRegistry jobRegistry; @Autowired private JobLauncher jobLauncher; @Scheduled(fixedDelay = 30000) //fix: , initialDelay = 5000) public void runJob() throws Exception { //init Job job = jobRegistry.getJob(MyJob.class.getSimpleName()); jobLauncher.run(job, params); } } {code} Running without the initialDelay throws the following exception: {code} org.springframework.batch.core.launch.NoSuchJobException: No job configuration with the name [myJob] was registered at org.springframework.batch.core.configuration.support.MapJobRegistry.getJob(MapJobRegistry.java:66) ~[spring-batch-core-3.0.2.RELEASE.jar:3.0.2.RELEASE] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.1.3.RELEASE.jar:4.1.3.RELEASE] at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.1.3.RELEASE.jar:4.1.3.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_51] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [?:1.7.0_51] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [?:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51] {code} spring-boot-1.2.0.RELEASE
    via by member sound,
  • Set job status to FAILED when killed
    via Stack Overflow by jmmut
    ,
    • org.springframework.batch.core.launch.NoSuchJobException: No job configuration with the name [myJob] was registered at org.springframework.batch.core.configuration.support.MapJobRegistry.getJob(MapJobRegistry.java:66)[spring-batch-core-3.0.2.RELEASE.jar:3.0.2.RELEASE] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)[spring-context-4.1.3.RELEASE.jar:4.1.3.RELEASE] at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)[spring-context-4.1.3.RELEASE.jar:4.1.3.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[?:1.7.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:262)[?:1.7.0_51] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[?:1.7.0_51] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[?:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[?:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[?:1.7.0_51] at java.lang.Thread.run(Thread.java:744)[?:1.7.0_51]
    No Bugmate found.