org.springframework.batch.core.UnexpectedJobExecutionException: Encountered an error saving batch meta data.

Spring JIRA | benjamin xi | 5 years ago
  1. 0

    This excepton didn't appear every time.It seems that Spring was updating the step's version after step finished.According to below logs,the current step's version was 548(want to update to 549) and its version was also 548 in DB.So the update should success.But we met below exception. 05 May 2012 10:21:27 [WAPIBatchScheduler_Worker-1] ERROR org.springframework.batch.core.step.AbstractStep - Encountered an error saving batch meta data.This job is now in an unknown state and should not be restarted. org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=1065721 with wrong version (548), where current version is 548 at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.updateStepExecution(JdbcStepExecutionDao.java:334) at org.springframework.batch.core.repository.support.SimpleJobRepository.saveOrUpdate(SimpleJobRepository.java:239) at org.springframework.batch.core.repository.support.SimpleJobRepository.saveOrUpdateExecutionContext(SimpleJobRepository.java:248) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:172) at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:125) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator$ContextClosingJob.execute(ClassPathXmlApplicationContextJobLocator.java:174) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator.run(ClassPathXmlApplicationContextJobLocator.java:100) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitJobExecution(SubmitJob.java:420) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitClusterJobExecution(SubmitJob.java:333) at com.webex.webapp.wbxconnect.batch.SpringBatchJobInvoker.execute(SpringBatchJobInvoker.java:77) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529) 05 May 2012 10:21:28 [WAPIBatchScheduler_Worker-1] ERROR com.webex.webapp.wbxconnect.batch.WapiGlobalJobStepListener - [Z2PJ8VTTIR8XSUTXJJ8BW2EWT9] [dirGrpIntegration] [] An error occurred in Job Execution org.springframework.batch.core.UnexpectedJobExecutionException: Encountered an error saving batch meta data. at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:218) at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:125) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator$ContextClosingJob.execute(ClassPathXmlApplicationContextJobLocator.java:174) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator.run(ClassPathXmlApplicationContextJobLocator.java:100) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitJobExecution(SubmitJob.java:420) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitClusterJobExecution(SubmitJob.java:333) at com.webex.webapp.wbxconnect.batch.SpringBatchJobInvoker.execute(SpringBatchJobInvoker.java:77) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

    Spring JIRA | 5 years ago | benjamin xi
    org.springframework.batch.core.UnexpectedJobExecutionException: Encountered an error saving batch meta data.
  2. 0

    This excepton didn't appear every time.It seems that Spring was updating the step's version after step finished.According to below logs,the current step's version was 548(want to update to 549) and its version was also 548 in DB.So the update should success.But we met below exception. 05 May 2012 10:21:27 [WAPIBatchScheduler_Worker-1] ERROR org.springframework.batch.core.step.AbstractStep - Encountered an error saving batch meta data.This job is now in an unknown state and should not be restarted. org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=1065721 with wrong version (548), where current version is 548 at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.updateStepExecution(JdbcStepExecutionDao.java:334) at org.springframework.batch.core.repository.support.SimpleJobRepository.saveOrUpdate(SimpleJobRepository.java:239) at org.springframework.batch.core.repository.support.SimpleJobRepository.saveOrUpdateExecutionContext(SimpleJobRepository.java:248) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:172) at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:125) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator$ContextClosingJob.execute(ClassPathXmlApplicationContextJobLocator.java:174) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator.run(ClassPathXmlApplicationContextJobLocator.java:100) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitJobExecution(SubmitJob.java:420) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitClusterJobExecution(SubmitJob.java:333) at com.webex.webapp.wbxconnect.batch.SpringBatchJobInvoker.execute(SpringBatchJobInvoker.java:77) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529) 05 May 2012 10:21:28 [WAPIBatchScheduler_Worker-1] ERROR com.webex.webapp.wbxconnect.batch.WapiGlobalJobStepListener - [Z2PJ8VTTIR8XSUTXJJ8BW2EWT9] [dirGrpIntegration] [] An error occurred in Job Execution org.springframework.batch.core.UnexpectedJobExecutionException: Encountered an error saving batch meta data. at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:218) at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:125) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator$ContextClosingJob.execute(ClassPathXmlApplicationContextJobLocator.java:174) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81) at com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator.run(ClassPathXmlApplicationContextJobLocator.java:100) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitJobExecution(SubmitJob.java:420) at com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitClusterJobExecution(SubmitJob.java:333) at com.webex.webapp.wbxconnect.batch.SpringBatchJobInvoker.execute(SpringBatchJobInvoker.java:77) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

    Spring JIRA | 5 years ago | benjamin xi
    org.springframework.batch.core.UnexpectedJobExecutionException: Encountered an error saving batch meta data.

    Root Cause Analysis

    1. org.springframework.batch.core.UnexpectedJobExecutionException

      Encountered an error saving batch meta data.

      at org.springframework.batch.core.step.AbstractStep.execute()
    2. Spring Batch Core
      SimpleJob.execute
      1. org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:218)
      2. org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:125)
      2 frames
    3. com.webex.webapp
      ClassPathXmlApplicationContextJobLocator$ContextClosingJob.execute
      1. com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator$ContextClosingJob.execute(ClassPathXmlApplicationContextJobLocator.java:174)
      1 frame
    4. Spring Batch Core
      SimpleJobLauncher$1.run
      1. org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86)
      1 frame
    5. Spring Core
      SyncTaskExecutor.execute
      1. org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
      1 frame
    6. Spring Batch Core
      SimpleJobLauncher.run
      1. org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81)
      1 frame
    7. com.webex.webapp
      SpringBatchJobInvoker.execute
      1. com.webex.webapp.wbxconnect.batch.ClassPathXmlApplicationContextJobLocator.run(ClassPathXmlApplicationContextJobLocator.java:100)
      2. com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitJobExecution(SubmitJob.java:420)
      3. com.webex.webapp.wbxconnect.executeplugin.batch.SubmitJob.submitClusterJobExecution(SubmitJob.java:333)
      4. com.webex.webapp.wbxconnect.batch.SpringBatchJobInvoker.execute(SpringBatchJobInvoker.java:77)
      4 frames
    8. quartz
      SimpleThreadPool$WorkerThread.run
      1. org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      2. org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
      2 frames