These are chat archives for spring-cloud/spring-cloud

28th
May 2017
Federico Ferreyra
@Fedeferreyra
May 28 2017 18:04

Hi everybody, I'm facing an error while trying to launch my task from CF dataflow server. The task is giving me this error:
org.springframework.context.ApplicationContextException: Failed to start bean 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution, ID 4 not found

While checking the code, I'm seeing this in class TaskLifecycleListener:
private void doTaskStart() {
if(!this.started) {
List<String> args = new ArrayList(0);
if(this.applicationArguments != null) {
args = Arrays.asList(this.applicationArguments.getSourceArgs());
}

        TaskExecution taskExecution;
        if(this.taskProperties.getExecutionid() != null) {
            taskExecution = this.taskExplorer.getTaskExecution(this.taskProperties.getExecutionid().longValue());
            Assert.notNull(taskExecution, String.format("Invalid TaskExecution, ID %s not found", new Object[]{this.taskProperties.getExecutionid()}));
            Assert.isNull(taskExecution.getEndTime(), String.format("Invalid TaskExecution, ID %s task is already complete", new Object[]{this.taskProperties.getExecutionid()}));
            this.taskExecution = this.taskRepository.startTaskExecution(this.taskProperties.getExecutionid().longValue(), this.taskNameResolver.getTaskName(), new Date(), (List)args, this.taskProperties.getExternalExecutionId(), this.taskProperties.getParentExecutionId());
        } else {
            taskExecution = new TaskExecution();
            taskExecution.setTaskName(this.taskNameResolver.getTaskName());
            taskExecution.setStartTime(new Date());
            taskExecution.setArguments((List)args);
            taskExecution.setExternalExecutionId(this.taskProperties.getExternalExecutionId());
            taskExecution.setParentExecutionId(this.taskProperties.getParentExecutionId());
            this.taskExecution = this.taskRepository.createTaskExecution(taskExecution);
        }
    } else {
        logger.error("Multiple start events have been received.  The first one was recorded.");
    }

    this.taskExecution.setExitMessage(this.invokeOnTaskStartup(this.taskExecution).getExitMessage());
}
So, my question is why dataflow server is sending an execution Id if it was not created yet?
Federico Ferreyra
@Fedeferreyra
May 28 2017 18:09
Is there something I can do to solve this?
Israel Fernández
@iferca
May 28 2017 18:36
Some additional context in case is helpful is that this task @Fedeferreyra mentioned is written in Kotlin.