org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly

Spring JIRA | Gérald Quintana | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When running the following flow {code:java} new FlowBuilder<SimpleFlow>("splitFlow") .split(jobTaskExecutor) .add(flow1(), flow2(), flow3()) .end(); {code} The following exception is raised: {code} org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:141) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: org.springframework.batch.core.job.flow.FlowExecutionException: Ended flow=splitFlow at state=splitFlow.split1 with exception at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:160) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130) at org.springframework.batch.core.job.flow.support.state.FlowState.handle(FlowState.java:55) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:151) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) ... 5 more Caused by: java.lang.IllegalArgumentException: No start state was found. You must specify at least one step in a job. at org.springframework.batch.core.job.flow.support.SimpleFlow.initializeTransitions(SimpleFlow.java:242) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:126) at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:93) at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:90) at java.util.concurrent.FutureTask.run(FutureTask.java:262) ... 3 more {code} Because the {{FlowBuild.SplitBuilder#add}} contains {code:java} State one = parent.currentState; Flow flow = null; if (!(one instanceof FlowState)) { FlowBuilder<Flow> stateBuilder = new FlowBuilder<Flow>(name + "_" + (counter++)); stateBuilder.currentState = one; flow = stateBuilder.build(); } {code} and `one` is null, an empty State is added to the flow. To fill the current state and avoid `one` from being null, the work around is to write: {code:java} new FlowBuilder<SimpleFlow>("splitFlow") .from(flow1()) .split(jobTaskExecutor) .add(flow2(), flow3()) .end(); {code} Please add a one != null in the if condition

    Spring JIRA | 3 years ago | Gérald Quintana
    org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly
  2. 0

    When running the following flow {code:java} new FlowBuilder<SimpleFlow>("splitFlow") .split(jobTaskExecutor) .add(flow1(), flow2(), flow3()) .end(); {code} The following exception is raised: {code} org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:141) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: org.springframework.batch.core.job.flow.FlowExecutionException: Ended flow=splitFlow at state=splitFlow.split1 with exception at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:160) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130) at org.springframework.batch.core.job.flow.support.state.FlowState.handle(FlowState.java:55) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:151) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) ... 5 more Caused by: java.lang.IllegalArgumentException: No start state was found. You must specify at least one step in a job. at org.springframework.batch.core.job.flow.support.SimpleFlow.initializeTransitions(SimpleFlow.java:242) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:126) at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:93) at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:90) at java.util.concurrent.FutureTask.run(FutureTask.java:262) ... 3 more {code} Because the {{FlowBuild.SplitBuilder#add}} contains {code:java} State one = parent.currentState; Flow flow = null; if (!(one instanceof FlowState)) { FlowBuilder<Flow> stateBuilder = new FlowBuilder<Flow>(name + "_" + (counter++)); stateBuilder.currentState = one; flow = stateBuilder.build(); } {code} and `one` is null, an empty State is added to the flow. To fill the current state and avoid `one` from being null, the work around is to write: {code:java} new FlowBuilder<SimpleFlow>("splitFlow") .from(flow1()) .split(jobTaskExecutor) .add(flow2(), flow3()) .end(); {code} Please add a one != null in the if condition

    Spring JIRA | 3 years ago | Gérald Quintana
    org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      No start state was found. You must specify at least one step in a job.

      at org.springframework.batch.core.job.flow.support.SimpleFlow.initializeTransitions()
    2. Spring Batch Core
      SplitState$1.call
      1. org.springframework.batch.core.job.flow.support.SimpleFlow.initializeTransitions(SimpleFlow.java:242)
      2. org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:126)
      3. org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:93)
      4. org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:90)
      4 frames
    3. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask.run(FutureTask.java:262)
      2. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      3. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      4. java.lang.Thread.run(Thread.java:744)
      4 frames