找不到产品名称的数据库类型:spring 批次中的 [Apache Hive]

DatabaseType not found for product name: [Apache Hive] in spring batch

我们当前的应用程序具有 Spring 个批处理作业,可与 RDBMS (Oracle) 配合使用。作为战略路线图的一部分,所有数据都将在 HIVE 中,并且不会依赖 Oracle (RDBMS)。作为该路线图的一部分,我们正在尝试进行 POC 以验证针对 Hive 执行 Spring Batch 的可行性。但是,当我们配置了 HIVE JDBC 驱动程序并尝试在 JBOSS 中本地部署应用程序时,我们收到异常“ 未找到产品名称的数据库类型:[Apache Hive ]”。这个问题是由于 JobRepositoryJsrJobParametersConverter 的配置引起的,因为它们都在寻找数据源产品名称的数据库类型。正如我们看到的 class org.springframework.batch.support.DatabaseType (spring-batch-infrastructure-4.0.0.RELEASE.jar) 不支持HIVE

由于找不到任何解决方案,我们遵循了 Spring 批处理文档“4.3.4 存储库中的非标准数据库类型”部分中提供的指南(虽然有限) "
https://docs.spring.io/spring-batch/docs/current/reference/html/index-single.html

根据文档中的 4.3.4 Non-standard Database Types in Repository 部分:

If even that doesn’t work, or you are not using an RDBMS, then the only option may be to implement the various Dao interfaces that the SimpleJobRepository depends on and wire one up manually in the normal Spring way.

由于您已经实现了作业存储库所依赖的 4 个 DAO,因此您可以创建一个 SimpleJobRepository 类型的 bean 并将您的 DAO 连接到其中。换句话说,不要使用 JobRepositoryFactoryBean 并自己创建 bean:

@Bean
public SimpleJobRepository hiveJobRepository(
    HiveJdbcJobInstanceDao hiveJdbcJobInstanceDao,
    HiveJdbcJobExecutionDao hiveJdbcJobExecutionDao,
    HiveJdbcStepExecutionDao hiveJdbcStepExecutionDao,
    JdbcHiveExecutionContextDao jdbcHiveExecutionContextDao) {

    return new SimpleJobRepository(hiveJdbcJobInstanceDao, hiveJdbcJobExecutionDao,
                               hiveJdbcStepExecutionDao, jdbcHiveExecutionContextDao);
}