问题
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