Reputation: 21
I am working with spring boot project and make as @Enabletask and tried to run with spring data flow.
I have up the spring dataflow server and in shell i tried to registered app and created task and when i run task i got the error.
By default it uses H2 database but i also tried with mysql also but facing same issue.
due to java.lang.IllegalArgumentException: Invalid TaskExecution, ID 1 not found, application is not able to run and i am unable to see start time, end time and exit code on localhost:9393/
1) Run dataflow server with mysql connection parameters. --spring.datasource.url=jdbc:mysql://localhost:3306/mydb --spring.datasource.username=root --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
2) Run dataflow shell with mysql connection parameters. --spring.datasource.url=jdbc:mysql://localhost:3306/mydb --spring.datasource.username=root --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
3) Execute task with mysql connection parameters. --spring.datasource.url=jdbc:mysql://localhost:3306/mydb --spring.datasource.username=root --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
Already added mysql dependency in pom file.
Please find below code of main class
package com.example.demo;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableTask
public class test {
@Bean
public CommandLineRunner commandLineRunner() {
return new HelloWorldCommandLineRunner();
}
public static void main(String[] args) {
SpringApplication.run(test.class, args);
}
public static class HelloWorldCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... strings) throws Exception {
System.out.println("Hello, World!");
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath />
<!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<!-- <spring-cloud.version>Greenwich.SR1</spring-cloud.version> -->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
<version>1.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>8.0.16</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Upvotes: 2
Views: 3167
Reputation: 323
I had a similar issue that I had reported on github. https://github.com/spring-cloud/spring-cloud-task/issues/446
The issue in my case was the spring boot and spring cloud versions. As I can see in your case as well, you are using spring boot 2.0.5 RELEASE whereas for spring cloud task starter you are using 1.2.3 RELEASE. This can cause a compatibility issue.
I would recommend you to try a newer release of that dependency which you can find here - https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-task
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-task -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
1.x.x versions of spring cloud starter task are compatible with 1.x.x version of spring boot, similarly 2.x.x will be compatible with 2.x.x.
Upvotes: 0
Reputation: 1723
Do you need a dependency on spring-boot-starter-jdbc? Also the mariadb driver. I assume mysql server is running. Check the log files for earlier errors.
Upvotes: 0