Spring cloud Dataflow Failed to start bean 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution

huangapple go评论77阅读模式
英文:

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 &#39;debug&#39; 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 &#39;taskLifecycleListener&#39;; 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(&quot;Hello world!!&quot;);
		}

	 }
	 
	 
	
}

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:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
	&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
	&lt;parent&gt;
		&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
		&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
		&lt;version&gt;2.1.4.RELEASE&lt;/version&gt;
		&lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
	&lt;/parent&gt;
	&lt;groupId&gt;com.edf.fr&lt;/groupId&gt;
	&lt;artifactId&gt;scdf-task-example&lt;/artifactId&gt;
	&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
	&lt;name&gt;scdf-task-example&lt;/name&gt;
	&lt;description&gt;Demo project for Spring Cloud Dataflow Task&lt;/description&gt;

	&lt;properties&gt;
		&lt;java.version&gt;1.8&lt;/java.version&gt;
		&lt;spring-cloud.version&gt;Hoxton.SR8&lt;/spring-cloud.version&gt;
	&lt;/properties&gt;

	&lt;dependencies&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
			&lt;artifactId&gt;spring-cloud-starter-task&lt;/artifactId&gt;
			&lt;version&gt;2.0.2.RELEASE&lt;/version&gt;
		&lt;/dependency&gt;
		

		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
			&lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
			&lt;scope&gt;test&lt;/scope&gt;
			&lt;exclusions&gt;
				&lt;exclusion&gt;
					&lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
					&lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
				&lt;/exclusion&gt;
			&lt;/exclusions&gt;
		&lt;/dependency&gt;
		
		&lt;dependency&gt;
			&lt;groupId&gt;com.oracle&lt;/groupId&gt;
			&lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
			&lt;version&gt;11.2.0.3&lt;/version&gt;
		&lt;/dependency&gt;
		
	&lt;dependency&gt;
    	&lt;groupId&gt;com.h2database&lt;/groupId&gt;
    	&lt;artifactId&gt;h2&lt;/artifactId&gt;
	&lt;/dependency&gt;
		
	&lt;/dependencies&gt;

	&lt;dependencyManagement&gt;
		&lt;dependencies&gt;
			&lt;dependency&gt;
				&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
				&lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
				&lt;version&gt;${​​spring-cloud.version}​​&lt;/version&gt;
			&lt;/dependency&gt;
		&lt;/dependencies&gt;
	&lt;/dependencyManagement&gt;

	&lt;build&gt;
		&lt;plugins&gt;
			&lt;plugin&gt;
				&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
				&lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
			&lt;/plugin&gt;
		&lt;/plugins&gt;
	&lt;/build&gt;



&lt;/project&gt;

And the pom.xml of my custom dataflow server:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
	&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
	&lt;parent&gt;
		&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
		&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
		&lt;version&gt;2.2.7.RELEASE&lt;/version&gt;
		&lt;relativePath/&gt;
	&lt;/parent&gt;
	&lt;groupId&gt;com.example&lt;/groupId&gt;
	&lt;artifactId&gt;custom-dataflow-server-maven&lt;/artifactId&gt;
	&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
	&lt;name&gt;custom-dataflow-server&lt;/name&gt;
	&lt;description&gt;Demo project for Spring Boot&lt;/description&gt;

	&lt;properties&gt;
		&lt;java.version&gt;1.8&lt;/java.version&gt;
		&lt;spring-cloud.version&gt;Hoxton.SR4&lt;/spring-cloud.version&gt;
		&lt;spring-cloud-dataflow.version&gt;2.5.1.RELEASE&lt;/spring-cloud-dataflow.version&gt;
		&lt;spring-security-oauth2.version&gt;2.3.7.RELEASE&lt;/spring-security-oauth2.version&gt;
		&lt;oracle.version&gt;11.2.0.3&lt;/oracle.version&gt;
		&lt;kubernetes-client.version&gt;4.1.0&lt;/kubernetes-client.version&gt;
		&lt;nimbus-jose-jwt.version&gt;8.17&lt;/nimbus-jose-jwt.version&gt;
	&lt;/properties&gt;

	&lt;dependencies&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
			&lt;artifactId&gt;spring-cloud-starter-dataflow-server&lt;/artifactId&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
			&lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
			&lt;scope&gt;test&lt;/scope&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework.security.oauth&lt;/groupId&gt;
			&lt;artifactId&gt;spring-security-oauth2&lt;/artifactId&gt;
			&lt;version&gt;${spring-security-oauth2.version}&lt;/version&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;io.fabric8&lt;/groupId&gt;
			&lt;artifactId&gt;kubernetes-client&lt;/artifactId&gt;
			&lt;version&gt;${kubernetes-client.version}&lt;/version&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;com.nimbusds&lt;/groupId&gt;
			&lt;artifactId&gt;nimbus-jose-jwt&lt;/artifactId&gt;
			&lt;version&gt;${nimbus-jose-jwt.version}&lt;/version&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;com.oracle&lt;/groupId&gt;
			&lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
			&lt;version&gt;11.2.0.3&lt;/version&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
    	&lt;groupId&gt;com.h2database&lt;/groupId&gt;
    	&lt;artifactId&gt;h2&lt;/artifactId&gt;
		&lt;/dependency&gt;
	&lt;/dependencies&gt;

	&lt;dependencyManagement&gt;
		&lt;dependencies&gt;
			&lt;dependency&gt;
				&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
				&lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
				&lt;version&gt;${spring-cloud.version}&lt;/version&gt;
				&lt;type&gt;pom&lt;/type&gt;
				&lt;scope&gt;import&lt;/scope&gt;
			&lt;/dependency&gt;
			&lt;dependency&gt;
				&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
				&lt;artifactId&gt;spring-cloud-dataflow-dependencies&lt;/artifactId&gt;
				&lt;version&gt;${spring-cloud-dataflow.version}&lt;/version&gt;
				&lt;type&gt;pom&lt;/type&gt;
				&lt;scope&gt;import&lt;/scope&gt;
			&lt;/dependency&gt;
		&lt;/dependencies&gt;
	&lt;/dependencyManagement&gt;

	&lt;build&gt;
		&lt;plugins&gt;
			&lt;plugin&gt;
				&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
				&lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
			&lt;/plugin&gt;
		&lt;/plugins&gt;
	&lt;/build&gt;

	&lt;repositories&gt;
		&lt;repository&gt;
			&lt;id&gt;spring-release&lt;/id&gt;
			&lt;name&gt;Spring Releases&lt;/name&gt;
			&lt;url&gt;https://repo.spring.io/release&lt;/url&gt;
		&lt;/repository&gt;
	&lt;/repositories&gt;
&lt;/project&gt;

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的数据库。

下面的问题可能与你的问题有关:

https://stackoverflow.com/questions/62887534/how-to-properly-compile-package-a-task-for-spring-cloud-data-flow/68601723#68601723

英文:

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

https://stackoverflow.com/questions/62887534/how-to-properly-compile-package-a-task-for-spring-cloud-data-flow/68601723#68601723

huangapple
  • 本文由 发表于 2020年10月22日 19:51:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/64481639.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定