title: Spring Batch Job Stop Using jobOperator
body: <p>I have Started my job using <code>jobLauncher.run(processJob,jobParameters);</code> and when i try stop job using another request <code>jobOperator.stop(jobExecution.getId());</code> then get exeption :</p>
  <blockquote>
  <p>org.springframework.batch.core.launch.JobExecutionNotRunningException:
  JobExecution must be running so that it can be stopped</p>
  </blockquote>
  <pre><code>Set&lt;JobExecution&gt; jobExecutionsSet= jobExplorer.findRunningJobExecutions(&quot;processJob&quot;);
          for (JobExecution jobExecution:jobExecutionsSet) {
              System.err.println(&quot;job status : &quot;+ jobExecution.getStatus());
              if (jobExecution.getStatus()== BatchStatus.STARTED|| jobExecution.getStatus()== BatchStatus.STARTING || jobExecution.getStatus()== BatchStatus.STOPPING){
                  jobOperator.stop(jobExecution.getId());
                  System.out.println(&quot;###########Stopped#########&quot;);
              }
          }
  </code></pre>
  <p>when print job status always get  <code>job status : STOPPING</code> but batch job is running</p>
  <p>its web app, first upload some CSV file and start some operation using spring batch and during this execution if user need stop then stop request from another controller method come and try to stop running job</p>
  <p>Please help me for stop running job</p>