问题
I have a task with 2 batch jobs, both jobs run but one of them fails. The status of the particular task is still shown as complete. i read about setting the spring.cloud.task.batch.failOnJobFailure property. When i set this property to true while running the task it gives me the following error:
o.s.boot.SpringApplication : Application startup failed
java.lang.AbstractMethodError: null
at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:402) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:447) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:415) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.getLifecycleBeans(DefaultLifecycleProcessor.java:273) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:131) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:852) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.2.RELEASE.jar!/:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.2
```.RELEASE.jar!/:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.2.RELEASE.jar!/:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.2.RELEASE.jar!/:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.2.RELEASE.jar!/:1.3.2.RELEASE]
at com.mediaiq.appnexus.batch.AppnexusBatchServiceApplication.main(AppnexusBatchServiceApplication.java:53) [classes!/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [aiq-appnexus-batch-service-3.23.1.jar:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [aiq-appnexus-batch-service-3.23.1.jar:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [aiq-appnexus-batch-service-3.23.1.jar:na]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [aiq-appnexus-batch-service-3.23.1.jar:na]
回答1:
This is most likely a version incompatibility issue.
There's a duplicate thread via spring-cloud/spring-cloud-dataflow-ui#917#issuecomment-425945144 that summarizes the various version compatibility scenarios.
If there are continued problems on the compatible stack, it'd be good to review a reproducible sample App.
来源:https://stackoverflow.com/questions/52531263/spring-cloud-task-status-shown-as-complete-even-when-the-batch-job-fails