英文:
Spring cloud Dataflow Failed to start bean 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution
问题
以下是您提供的内容的翻译:
我正在尝试在使用 Oracle 数据库依赖项的自定义 Spring Cloud Dataflow 本地服务器中执行一个简单的 Spring Cloud Task hello world 示例(https://docs.spring.io/spring-cloud-task/docs/2.0.0.RELEASE/reference/htmlsingle/#getting-started-developing-first-task),但在执行过程中遇到了以下错误:
启动应用程序上下文时出错。要显示条件报告,请使用“debug”启用调试模式。
2020-10-22 10:27:02.246 ERROR 21996 --- [main] o.s.c.t.listener.TaskLifecycleListener : 收到结束任务的事件,但该任务尚未启动。
2020-10-22 10:27:02.253 ERROR 21996 --- [main] o.s.boot.SpringApplication : 应用程序运行失败
org.springframework.context.ApplicationContextException:无法启动 bean 'taskLifecycleListener';嵌套异常是 java.lang.IllegalArgumentException:无效的 TaskExecution,未找到 ID 43
以下是主应用程序的代码:
package com.edf.fr.scdftaskexample;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@SpringBootApplication
@EnableTask
public class ScdfTaskExampleApplication{
@Bean
public CommandLineRunner commandLineRunner(){
return new HelloWorldCommandLineRunner();
}
public static void main(String[] args) {
SpringApplication.run(ScdfTaskExampleApplication.class, args);
}
public static class HelloWorldCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
System.out.println("Hello world!!");
}
}
}
以下是 application.properties
文件的内容:
spring.datasource.url=jdbc:oracle:thin:@infra-dbaas-vm010.noe.edf.fr:1521/DBST000J_S.noe.edf.fr
spring.datasource.username=happydap
spring.datasource.password=Droopydap9*
spring.datasource.driver.class=oracle.jdbc.driver.OracleDriver
logging.level.org.springframework.cloud.task=DEBUG
spring.application.name=helloWorld
以下是 Spring Cloud Task 的 pom.xml
:
<!-- 在此省略了 pom.xml 的内容 -->
以下是自定义数据流服务器的 pom.xml
:
<!-- 在此省略了 pom.xml 的内容 -->
是否有某些配置遗漏?如何使其运行起来?谢谢。
英文:
I'm trying to execute a simple Spring Cloud Task hello world example(https://docs.spring.io/spring-cloud-task/docs/2.0.0.RELEASE/reference/htmlsingle/#getting-started-developing-first-task) in a custom Spring Cloud Dataflow Server local that uses oracle database dependency and I'm getting this error during it's execution:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-10-22 10:27:02.246 ERROR 21996 --- [ main] o.s.c.t.listener.TaskLifecycleListener : An event to end a task has been received for a task that has not yet started.
2020-10-22 10:27:02.253 ERROR 21996 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution, ID 43 not found
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at com.edf.fr.scdftaskexample.ScdfTaskExampleApplication.main(ScdfTaskExampleApplication.java:23) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_161]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [scdf-task-example-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [scdf-task-example-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [scdf-task-example-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [scdf-task-example-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.IllegalArgumentException: Invalid TaskExecution, ID 43 not found
at org.springframework.util.Assert.notNull(Assert.java:198) ~[spring-core-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.cloud.task.listener.TaskLifecycleListener.doTaskStart(TaskLifecycleListener.java:244) ~[spring-cloud-task-core-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.cloud.task.listener.TaskLifecycleListener.start(TaskLifecycleListener.java:366) ~[spring-cloud-task-core-2.0.2.RELEASE.jar!/:2.0.2.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
... 20 common frames omitted
Here's the code for the main application:
package com.edf.fr.scdftaskexample;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@SpringBootApplication
@EnableTask
public class ScdfTaskExampleApplication{
@Bean
public CommandLineRunner commandLineRunner(){
return new HelloWorldCommandLineRunner();
}
public static void main(String[] args) {
SpringApplication.run(ScdfTaskExampleApplication.class, args);
}
public static class HelloWorldCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
System.out.println("Hello world!!");
}
}
}
application.properties:
spring.datasource.url=jdbc:oracle:thin:@infra-dbaas-vm010.noe.edf.fr:1521/DBST000J_S.noe.edf.fr
spring.datasource.username=happydap
spring.datasource.password=Droopydap9*
spring.datasource.driver.class=oracle.jdbc.driver.OracleDriver
logging.level.org.springframework.cloud.task=DEBUG
spring.application.name=helloWorld
Here's the pom.xml for the Spring Cloud Task:
<?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 https://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.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.edf.fr</groupId>
<artifactId>scdf-task-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>scdf-task-example</name>
<description>Demo project for Spring Cloud Dataflow Task</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
And the pom.xml of my custom dataflow server:
<?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.2.7.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>custom-dataflow-server-maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>custom-dataflow-server</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR4</spring-cloud.version>
<spring-cloud-dataflow.version>2.5.1.RELEASE</spring-cloud-dataflow.version>
<spring-security-oauth2.version>2.3.7.RELEASE</spring-security-oauth2.version>
<oracle.version>11.2.0.3</oracle.version>
<kubernetes-client.version>4.1.0</kubernetes-client.version>
<nimbus-jose-jwt.version>8.17</nimbus-jose-jwt.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-dataflow-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring-security-oauth2.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>${kubernetes-client.version}</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose-jwt.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dataflow-dependencies</artifactId>
<version>${spring-cloud-dataflow.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-release</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
</repository>
</repositories>
</project>
Am I missing some configuration here. How can I get this to run? Thanks.
答案1
得分: 1
关于SCDF的数据库,基本上,如果你的SCDF运行良好,但任务由于错误无法运行,
> 无效的TaskExecution,找不到ID 43
意味着你的任务应用未连接到SCDF的数据库,因此无法获取任务执行ID,你可能需要检查数据库驱动程序(添加jar库)或检查任务应用是否指向SCDF的数据库。
下面的问题可能与你的问题有关:
英文:
It's about SCDF's database, basically, if your SCDF works well, and your task cannot run due to the error
> Invalid TaskExecution, ID 43 not found
Meaning your task application does not connect to the SCDF's database, so It cannot get the Task Execution ID, you might need to check your database driver (add jar library) or check the task application if it points to SCDF's database
The issue below might link to your issue
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论