gpt4 book ai didi

java - Spring Batch CommandLineJobRunner -next 使用旧的 run.id

转载 作者:太空宇宙 更新时间:2023-11-04 08:00:06 24 4
gpt4 key购买 nike

我们正在使用 CommandLineJobRunner 来执行 Spring Batch 作业。我们在命令行上使用 -next:

java -Dlog4j.configuration=file:./prop/log4j.properties -Dlogfile=logfile_load_data -jar EtlLoadData.jar loaddata_etl_config.xml loaddata_etl_job -next

我们开始遇到错误:

Job Terminated in error: A job instance already exists and is complete for parameters={run.id=10}.  If you want to run this job again, change the parameters. 

org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException: A job instance already exists and is complete for parameters={run.id=10}. If you want to run this job again, change the parameters.
at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean$1.invoke(AbstractJobRepositoryFactoryBean.java:168)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy14.createJobExecution(Unknown Source)
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:111)
at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:349)
at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)

我认为如果您使用 -next 选项运行,这应该不是问题。有什么想法吗?

作为临时解决方法,我清理了数据库中的 SpringBatch 表,但我不希望这种情况再次发生。

最佳答案

不知道 -next 选项。

最快的方法是将当前时间戳作为参数传递给您的作业。这样它就会是独一无二的,并且不会真正干扰您的工作。

关于java - Spring Batch CommandLineJobRunner -next 使用旧的 run.id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12976662/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com