简体   繁体   English

SpringBoot + Batch + Cloud Task @EnableTask 单数据源注解导致“序列不存在”问题

[英]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 ).目前我正在使用 SpringBoot(2.3.3 版本)和 Batch(4.2.4 版本)和 spring-cloud-starter-tsk(2.2.3 版本)和单一数据源(oracle)。 My BatchConfiguration extends the DefaultBatchConfigurer and made setDataSource.我的 BatchConfiguration 扩展了 DefaultBatchConfigurer 并制作了 setDataSource。 Now I'm trying to connect the Oracle DB and read records & generate the flatfile.现在我正在尝试连接 Oracle DB 并读取记录并生成平面文件。

I'm getting below error and strange thing is I'm able to get the datasource and SEQUENCE (TASK_SEQ ) is available in DB.我遇到了以下错误,奇怪的是我能够获取数据源并且 SEQUENCE (TASK_SEQ ) 在 DB 中可用。

在此处输入图片说明

Please find my other files below请在下面找到我的其他文件

  • BatchConfiguraton.java is BatchConfiguraton.java 是

在此处输入图片说明

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

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

In your batch configuration, you are using the MapJobRepositoryFactoryBean which creates a Map-based JobRepository in-memory.在您的批处理配置中,您使用的是MapJobRepositoryFactoryBean ,它在内存中创建一个基于 Map 的 JobRepository。 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 .您需要删除它并使用基于 JDBC 的作业存储库指向您的 Oracle 数据源,如参考文档中所述: 配置 JobRepository

You need to make sure that Spring Batch meta-data tables are created in your Oracle database before running your job.在运行作业之前,您需要确保在 Oracle 数据库中创建了 Spring Batch 元数据表。

The same configuration should be done for Spring Cloud Task as well.也应该对 Spring Cloud Task 进行相同的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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