1.Spring Batch - A job instance already exists: JobInstanceAlreadyCompleteException

这是因为JobParameters 相同的任务只能成功运行一次 ,如果连续运行同一个job ,则会出现此异常,即launcher.run(job, new JobParameters())只能调用一次。

一个job由job的id和参数唯一确定,所以我们可以在参数中增加一个时间的参数,这样可以保证这个参数每次都会不同,从而可以多次调用,如下:

JobParametersBuilder builder = new JobParametersBuilder();
builder.addDate("date", new Date());
launcher.run(job, builder.toJobParameters());

这样就可以多次调用job了,参考链接:https://stackoverflow.com/questions/22455739/spring-batch-a-job-instance-already-exists-jobinstancealreadycompleteexceptio

http://blog.csdn.net/chenlei65368/article/details/8958770

相关文章:

  • 2021-10-14
  • 2021-06-03
  • 2021-12-09
  • 2021-06-15
  • 2021-10-07
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-06
  • 2021-11-03
  • 2022-01-23
  • 2022-01-06
  • 2021-12-26
  • 2021-08-31
  • 2021-10-29
相关资源
相似解决方案