Closed Srkanna closed 4 years ago
I'm going to close this since it is a question instead of an issue. Please post a question in StackOverflow and tag it with spring-cloud-task
and we can answer it there.
Hi Michael, Thanks for the notification. As suggested I have posted this on StackOverflow. It's been 2 weeks since. But I yet to get any response. This issue is a show stopper here. I have given the StackOverflow link below. Any help would be appreciable.
My guess it's not working is because of the two datasources used in the same application. Though I have proided the default datasource through DefaultTaskConfigurer Implementation.
Thanks, Rajeshkannan.S
On Thu, Apr 23, 2020 at 7:44 PM Michael Minella notifications@github.com wrote:
Closed #662 https://github.com/spring-cloud/spring-cloud-task/issues/662 .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spring-cloud/spring-cloud-task/issues/662#event-3265187157, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHC2LJDKIUPHVPG3W22STQTROBEL7ANCNFSM4MO2KVZQ .
Hi, I'm trying to run a Spring batch jar through SCDF. I ue two datasources one for reading and one for writing and both are Oracle. The dataSource I used to write is primary datasource in Spring batch project. Coming to SCDF I use a Custom Build version to include oracle driver dependencies. Below is the custom SCDF project location. https://github.com/spring-cloud/spring-cloud-dataflow-samples/tree/master/custom-dataflow-builds/dataflow-server-22x I my local Spring batch project I implemented DefaultTaskConfigurer to provide my primary datasource. So when I run the Batch project from IDE with the project runs fine, Reads records from secondary datasource and writes into primary datasource. But when I deploy the batch jar to custom build SCDF as task and launch it, I get an error that says,
org.springframework.context.ApplicationContextException: Failed to start bean 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution, ID 3 not found
When I checked the task Execution table (which can be accessed via primary datasource), the task execution ID is there in the table. But still I get this error. For each each run a new task Id is inserted int Task_execution table but I get the above error message with newly inserted task_execution id. Below are the project specifics:I load all of my Batch_jobs from main class of Boot using the instance of batch job class and only the main class (which kickstarts all jobs)contains @EnableTask annotation. Below is my class structure.
` I use two different datasources in my Spring job project, both are oracle datasource(Different servers).I marked one of them as primary and used that Datasource in my custom implementation of "DefaultTaskConfigurer" as below.
@Configuration public class TaskConfig extends DefaultTaskConfigurer { @Autowired DatabaseConfig databaseConfig; @Override public DataSource getTaskDataSource() { return databaseConfig.dataSource();//dataSource() returns the primary ds } } Below are the properties I use in both SCDF custom serer and Spring Batch project.