OpenSourceDev
OpenSourceDev

Reputation: 41

SpringBoot + Batch + Cloud Task @EnableTask annotation with single datasource causes "Sequence does not exist" Issue

Currently I'm using the SpringBoot ( 2.3.3 Version ) and Batch ( 4.2.4 Version ) and spring-cloud-starter-tsk ( 2.2.3 Version ) with Single Datasource ( oracle ). My BatchConfiguration extends the DefaultBatchConfigurer and made setDataSource. Now I'm trying to connect the Oracle DB and read records & generate the flatfile.

I'm getting below error and strange thing is I'm able to get the datasource and SEQUENCE (TASK_SEQ ) is available in DB.

enter image description here

Please find my other files below

enter image description here

-application.yml is enter image description here

Upvotes: 0

Views: 1086

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31590

In your batch configuration, you are using the MapJobRepositoryFactoryBean which creates a Map-based JobRepository in-memory. You need to remove this and use the JDBC based job repository pointing to your Oracle datasource as described in the reference documentation: Configuring a JobRepository.

You need to make sure that Spring Batch meta-data tables are created in your Oracle database before running your job.

The same configuration should be done for Spring Cloud Task as well.

Upvotes: 2

Related Questions