简体   繁体   中英

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.

在此处输入图片说明

Please find my other files below

  • BatchConfiguraton.java is

在此处输入图片说明

  • Application.java is 在此处输入图片说明

-application.yml is 在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM