I am having problems with composed tasks on spring cloud data flow, I get the following error
2025-04-03 15:06:40.357 INFO 2040 --- [ main] o.s.c.d.c.ComposedTaskRunner : Starting ComposedTaskRunner using Java 21.0.6 on DESKTOP-OTUL16G with PID 2040 (C:\Users\Danilo\.m2\repository\\springframework\cloud\spring-cloud-dataflow-composed-task-runner\2.11.5\spring-cloud-dataflow-composed-task-runner-2.11.5.jar started by Danilo in C:\Users\Danilo\AppData\Local\Temp\82577490468400\testecomposed-0919fd23-94f5-4179-b79b-fd0ecdda569e)
2025-04-03 15:06:40.367 INFO 2040 --- [ main] o.s.c.d.c.ComposedTaskRunner : No active profile set, falling back to 1 default profile: "default"
2025-04-03 15:06:43.684 INFO 2040 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2025-04-03 15:06:43.687 INFO 2040 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2025-04-03 15:06:43.711 INFO 2040 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14 ms. Found 0 JPA repository interfaces.
2025-04-03 15:06:44.268 INFO 2040 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '.springframework.cloud.task.batch.configuration.TaskBatchAutoConfiguration' of type [.springframework.cloud.task.batch.configuration.TaskBatchAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2025-04-03 15:06:44.636 WARN 2040 --- [ main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: .springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is .springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is .springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
2025-04-03 15:06:44.665 INFO 2040 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2025-04-03 15:06:44.699 ERROR 2040 --- [ main] o.s.boot.SpringApplication : Application run failed
.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is .springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is .springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
at .springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:532) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1171) ~[spring-context-5.3.39.jar!/:5.3.39]
at .springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) ~[spring-context-5.3.39.jar!/:5.3.39]
at .springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591) ~[spring-context-5.3.39.jar!/:5.3.39]
at .springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.7.18.jar!/:2.7.18]
at .springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-2.7.18.jar!/:2.7.18]
at .springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) ~[spring-boot-2.7.18.jar!/:2.7.18]
at .springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.18.jar!/:2.7.18]
at .springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.7.18.jar!/:2.7.18]
at .springframework.boot.SpringApplication.run(SpringApplication.java:1289) ~[spring-boot-2.7.18.jar!/:2.7.18]
at .springframework.cloud.dataflowposedtaskrunner.ComposedTaskRunner.main(ComposedTaskRunner.java:31) ~[classes!/:na]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
at .springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[spring-cloud-dataflow-composed-task-runner-2.11.5.jar:na]
at .springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[spring-cloud-dataflow-composed-task-runner-2.11.5.jar:na]
at .springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[spring-cloud-dataflow-composed-task-runner-2.11.5.jar:na]
at .springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[spring-cloud-dataflow-composed-task-runner-2.11.5.jar:na]
Caused by: .springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is .springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
at .springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:646) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:626) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781) ~[spring-beans-5.3.39.jar!/:5.3.39]
... 27 common frames omitted
Caused by: .springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
at .springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.39.jar!/:5.3.39]
at .springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:641) ~[spring-beans-5.3.39.jar!/:5.3.39]
... 41 common frames omitted
Caused by: java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
at .springframework.util.Assert.state(Assert.java:97) ~[spring-core-5.3.39.jar!/:5.3.39]
at .springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:175) ~[spring-boot-autoconfigure-2.7.18.jar!/:2.7.18]
at .springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:125) ~[spring-boot-autoconfigure-2.7.18.jar!/:2.7.18]
at .springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48) ~[spring-boot-autoconfigure-2.7.18.jar!/:2.7.18]
at .springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90) ~[spring-boot-autoconfigure-2.7.18.jar!/:2.7.18]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
at .springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.39.jar!/:5.3.39]
... 42 common frames omitted
I have just a simple spring batch job project, available here
And since I am using an Oracle database I have compiled the spring cloud data flow server with the profile local-dev-oracle, because by default it doesn't include the oracle dependency
Running Locally w/ Oracle
By default, the Dataflow server jar does not include the Oracle database driver dependency. If you want to use Oracle for development/testing when running locally, you can specify the
local-dev-oracle
Maven profile when building.
If I run the tasks isolated on spring cloud data flow, it works but when I do a composed task, one after the other, I get that error above.
This is the command I use to launch the dataflow server jar
java -jar spring-cloud-dataflow-server-2.11.5.jar --spring.cloud.dataflow.features.tasks_enabled=true --spring.cloud.dataflow.features.jobs.enabled=true --spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/XEPDB1 --spring.datasource.username=myuser --spring.datasource.password=mypassword --spring.datasource.driver-class-name=oracle.jdbc.OracleDriver --spring.sql.init.mode=always
I have tried with Postgres database and works, with Oracle it isn't
Thanks