I am using Spring Batch 3.0.5 and Spring Boot, along with job launcher, but whenever I run my job I get the following error:
org.springframework.jdbc.BadSqlGrammarException:
PreparedStatementCallback; bad SQL grammar [SELECT VERSION FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID=?];
nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: BATCH_JOB_EXECUTION
Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: BATCH_JOB_EXECUTION
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1557)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:638)
Caused by: org.springframework.dao.ConcurrencyFailureException:
PreparedStatementCallback; SQL [INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)];
transaction rollback: serialization failure; nested exception is java.sql.SQLTransactionRollbackException: transaction rollback: serialization failure
Edit: The error resolved itself when I updated Spring from version 4.0.0 release to 4.2.3 release.
Now the batch is running but it is not executing the steps after first run.
During the first run I get the following error:
ERROR 8442 --- o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
org.springframework.dao.ConcurrencyFailureException: PreparedStatementCallback; SQL [INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)]; transaction rollback: serialization failure; nested exception is java.sql.SQLTransactionRollbackException: transaction rollback: serialization failure
and the after each run of the batch I am getting following output in the command line.
INFO 8442 --- com.capitalone.schduler.BatchScheduler : sendMailToCustomers Job ran at 11/10/2016 10:37:06
INFO 8442 --- com.capitalone.schduler.BatchScheduler : triggering BatchConfiguration at time {}11/10/2016 10:37:06
INFO 8442 --- o.s.b.c.l.support.SimpleJobLauncher : Job: [FlowJob: [name=queueInfoStep]] launched with the following parameters: [{JOB_START_DATE=Thu Nov 10 10:37:06 EST 2016}]
INFO 8442 --- o.s.batch.core.job.SimpleStepHandler : Executing step: [queueInfoStep]
INFO 8442 --- o.s.b.c.l.support.SimpleJobLauncher : Job: [FlowJob: [name=queueInfoStep]] completed with the following parameters: [{JOB_START_DATE=Thu Nov 10 10:37:06 EST 2016}] and the following status: [COMPLETED]