使用与Spring Cloud Data Flow中的默认端口(9393)不同的端口组成的任务

时间:2018-07-11 18:45:14

标签: spring spring-data spring-batch spring-cloud-dataflow spring-cloud-task

我已经使用端口8181初始化了Spring Data Flow Server,并且我一直试图使用此特定服务器运行组合任务。 当我尝试独立运行任务时,它们运行得很好,但是当我尝试在“组合任务”中运行它们时,它将失败。

以下是详细信息:

初始化Spring Cloud Server:

java -jar spring-cloud-dataflow-server-local-1.5.2.RELEASE.jar \
    --spring.datasource.url=jdbc:mysql://0.0.0.0:3306/sdataflow \
    --spring.datasource.username=myUser\
    --spring.datasource.password=myPassword\
    --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver \
    --spring.cloud.dataflow.server.uri=http://0.0.0.0:8181 \
    --logging.level.org.springframework.cloud.task=DEBUG \
    --server.port=8181

使用composition-task-runner运行组合任务:

java -jar composedtaskrunner-task-2.0.0.M1.jar --graph="A && B" --dataflow-server-uri="http://0.0.0.0:8181"

我也尝试过使用UI运行相同的组合任务,但出现了完全相同的错误。由于某种原因,该配置正在请求指向 http://localhost:9393 的资源。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataFlowOperations' defined in class path resource [org/springframework/cloud/dataflow/rest/client/config/DataFlowClientAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.dataflow.rest.client.DataFlowOperations]: Factory method 'dataFlowOperations' threw exception; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:9393": Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar!/:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar!/:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar!/:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar!/:2.0.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar!/:2.0.1.RELEASE]
    at org.springframework.cloud.task.app.composedtaskrunner.ComposedtaskrunnerTaskApplication.main(ComposedtaskrunnerTaskApplication.java:29) [classes!/:2.0.0.M1]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [composedtaskrunner-task-2.0.0.M1.jar:2.0.0.M1]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [composedtaskrunner-task-2.0.0.M1.jar:2.0.0.M1]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [composedtaskrunner-task-2.0.0.M1.jar:2.0.0.M1]

1 个答案:

答案 0 :(得分:1)

我们在最新的1.1.1.Rosease of Composed Task Runner中遇到了一个问题,其中--dataflow-server-uri属性在运行时无法识别[请参见spring-cloud-task-app-starters/composed-task-runner#39]。在2.0 M1中也很可能是一个问题。我们将在下周计划的2.0 GA(Dearborn.RELEASE)中对其进行修复。

与此同时,

您可以切换到1.1.0.RELEASE(具有--dataflow-server-uri属性),也可以改用DSL中的完整属性--spring.cloud.dataflow.client.server-uri="http://0.0.0.0:8181"