Error when launching tasks with multiple arguments from UI spring cloud dataflow

1k Views Asked by At

I have a batch job with takes 2 parameters. when I pass these arguments while running the jar file directly, it works. Also when i pass these arguments via the shell of the spring cloud dataflow it works:

dataflow:>task launch --name adv-load --arguments "appnexus_seat=SEAT_MIQ_1 last_modified=2018/08/10"
Launched task 'adv-load'

But when I pass the similar arguments while running the task form the UI, it fails. Example, In the UI, i passed: appnexus_seat & last_modified as 2 keys with the same values as above but a different date so that it doesnt think its the same job. This failed.

I did however manage to find the issue. When i run the task via shell, in the logs I get this:

2018-09-21 14:04:50.970  INFO 4035 --- [           main] o.s.b.a.b.JobLauncherCommandLineRunner   : Running default command line with: [appnexus_seat=SEAT_MIQ_1, last_modified=2018/08/10, --spring.cloud.task.executionid=5]
2018-09-21 14:04:51.073  INFO 4035 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=advertiserLoadJob]] launched with the following parameters: [{appnexus_seat=SEAT_MIQ_1, -spring.cloud.task.executionid=5, last_modified=2018/08/10}]
2018-09-21 14:04:51.081  INFO 4035 --- [           main] o.s.c.t.b.l.TaskBatchExecutionListener   : The job execution id 5 was run within the task execution 5
2018-09-21 14:04:51.116  INFO 4035 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [advertiserLoadStep1]

Whereas when i run it via the Ui i get this:

2018-09-21 14:05:57.417  INFO 4924 --- [           main] o.s.b.a.b.JobLauncherCommandLineRunner   : Running default command line with: [appnexus_seat=SEAT_MIQ_1,last_modified=2018/08/10, --spring.cloud.task.executionid=6]
2018-09-21 14:05:57.518  INFO 4924 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=advertiserLoadJob]] launched with the following parameters: [{appnexus_seat=SEAT_MIQ_1,last_modified=2018/08/10, -spring.cloud.task.executionid=6}]
2018-09-21 14:05:57.528  INFO 4924 --- [           main] o.s.c.t.b.l.TaskBatchExecutionListener   : The job execution id 6 was run within the task execution 6
2018-09-21 14:05:57.586  INFO 4924 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [advertiserLoadStep1]
2018-09-21 14:05:57.653 ERROR 4924 --- [           main] o.s.batch.core.step.AbstractStep         : Encountered an error executing step advertiserLoadStep1 in job advertiserLoadJob

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.advertiserLoadTasklet': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mediaiq.appnexus.load.client.AppnexusRestClient com.mediaiq.appnexus.batch.tasklet.AbstractPageLoadTasklet.appnexusClient; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'JOB' defined in class path resource [com/mediaiq/appnexus/load/config/AppnexusRestClientFactory.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.mediaiq.appnexus.value.AppnexusSeat]: : Failed to convert value of type [java.lang.String] to required type [com.mediaiq.appnexus.value.AppnexusSeat]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.mediaiq.appnexus.value.AppnexusSeat]: no matching editors or conversion strategy found; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type [java.lang.String] to required type [com.mediaiq.appnexus.value.AppnexusSeat]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.mediaiq.appnexus.value.AppnexusSeat]: no matching editors or conversion strategy found

If you look at the difference you can see that when i run it via the shell it gives a space between the 2 arguments whereas when i run it via the Ui its doesn't. Not giving this space results in an issue as the value of the first argument becomes "SEAT_MIQ_1,last_modified=2018/08/10" instead of just being "SEAT_MIQ_1" and last_modified being another argument.

Please let me know how to resolve this. Thanks. :)

1

There are 1 best solutions below

7
On BEST ANSWER

When you run the task from the UI, you need to specify each argument in a separate field:

enter image description here

This will correctly pass parameters to your task.