Spring boot+Spring Batch+MySql not working

戏子无情 提交于 2021-01-29 18:40:19

问题


I am creating a spring batch application using spring boot and mysql as the JPA repository and deploying on cloud foundry. While duing cf-push the batch process is crashed with error Process crashed with type web. However the underlying error message shows

2019-01-11T07:56:08.856-06:00 [APP/PROC/WEB/0] [OUT] org.springframework.dao.DataAccessResourceFailureException: Unable to commit new sequence value changes for BATCH_JOB_EXECUTION_SEQ 2019-01-11T07:56:08.856-06:00 [APP/PROC/WEB/0] [OUT] at org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer.getNextKey(MySQLMaxValueIncrementer.java:177) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE] 2019-01-11T07:56:08.856-06:00 [APP/PROC/WEB/0] [OUT] at org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.nextLongValue(AbstractDataFieldMaxValueIncrementer.java:128) ~[spring-jdbc-5.1.3.RELEASE.jar!/:5.1.3.RELEASE] 2019-01-11T07:56:08.856-06:00 [APP/PROC/WEB/0] [OUT] at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.saveJobExecution(JdbcJobExecutionDao.java:154) ~[spring-batch-core-4.1.0.RELEASE.jar!/:4.1.0.RELEASE] 2019-01-11T07:56:08.856-06:00 [APP/PROC/WEB/0] [OUT] at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:151) ~[spring-batch-core-4.1.0.RELEASE.jar!/:4.1.0.RELEASE]

I have been facing this issue for last 3 days and tried lot of sugggestions from google but no luck yet. The error shows


回答1:


I think I have an autowired JobLauncher and @Bean JobLauncher which made two calls to DB at the same time(atleast I am thinking this as the reason :) ). When I removed the @Bean JobLauncher as I am using Spring boot, the application started working fine.



来源:https://stackoverflow.com/questions/54148367/spring-bootspring-batchmysql-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!