Open klopfdreh opened 5 days ago
I found the issue! We are defining the JobRepository
and the JobExplorer
like mentioned here: https://github.com/spring-projects/spring-batch/issues/3942 - we migrated to spring batch 5, but with SCDF 2.11.x you have to be careful, because you also need to apply the table prefix to both repositories.
Example:
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
factory.setSerializer(batchJackson2ExecutionContextStringSerializer);
factory.setDataSource(dataSource);
factory.setTransactionManager(transactionManager);
factory.setIsolationLevelForCreateEnum(Isolation.DEFAULT);
String tablePrefix = batchProperties.getJdbc().getTablePrefix();
if (tablePrefix != null) {
factory.setTablePrefix(tablePrefix);
}
factory.afterPropertiesSet();
return Objects.requireNonNull(factory.getObject());
Could you add this as a hint to the documentation that you need to be careful while defining those repositories?
Description: As we migrate to Spring Boot 3 / Spring Batch 5 / Spring Cloud Task 3 applications we are currently facing a bug that the started task application seems not to choose the right table prefix even if the environment variables for the kubernetes Pod seem to be set correctly.
We saw in the environment variables of the kubernetes pod: SPRING_BATCH_JDBC_TABLE-PREFIX=BOOT3BATCH SPRING_CLOUD_TASK_TABLEPREFIX=BOOT3TASK
but we are still receiving an exception relating to the database schema.
Release versions:
Custom apps: N/A
Steps to reproduce: N/A
Screenshots:
![image](https://github.com/spring-cloud/spring-cloud-dataflow/assets/980773/4c75c83a-38c2-4bd6-b376-9ce0a2c51770)
Additional context: The Composed Task Runner is still Spring Boot 2.
ORA-00904: \"PARAMETER_VALUE\": ungültige ID = ORA-00904: \"PARAMETER_VALUE\": invalid ID
As you can see
BATCH_JOB_EXECUTION_PARAMS
is used and notBOOT3_BATCH_JOB_EXECUTION_PARAMS
Even if we set the table prefix in the application.yml it seems they are not used:
The dependencies in our task application are also set correctly:
![image](https://github.com/spring-cloud/spring-cloud-dataflow/assets/980773/66ebeba7-f660-4aed-b6db-a397ce1049ca)
As of the documentation SCDF should use the right prefix based on the registration of the application - https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#_spring_cloud_task_batch_applications