1

I'm seeing a problem when I try to get a job execution list either in the UI 'Jobs' tab ('Error fetching data. Is the Data Flow server running?') or via the REST API (500 NullPointerException).

The error from the log is

java.lang.NullPointerException: null
at org.springframework.cloud.dataflow.server.service.impl.DefaultTaskJobService.getTaskJobExecution(DefaultTaskJobService.java:231) ~[spring-cloud-dataflow-server-core-1.1.2.RELEASE.jar!/:1.1.2.RELEASE]

which seems to be caused by the code:

taskExplorer.getTaskExecutionIdByJobExecutionId(jobExecution.getId())

Looking into this it seems some of my jobs have not been associated with task ids - ie there is no entry in the task_task_batch table and if I try to retrieve one of those jobs or a list of all jobs I get the NullPointerException.

Retrieving a job directly by id which does have an association in the task_task_batch table is OK.

Investigating why this is happening with some of my job tasks it seems to be because some of them use XML instead of Java Config to configure the jobs (We have some pre-existing complex jobs that we are moving from XD to Spring Cloud Data Flow and keeping the XML is the quickest way initially to do this).

Otherwise these jobs are running fine, and logging job/step executions to the DB.

When using XML it seems the taskBatchExecutionListener is not getting added to the job automatically and so the task/batch association does not get registered.

The code for this is in TaskBatchExecutionListenerBeanPostProcessor and it could be because when using XML config the job bean is of type JobParserJobFactoryBean and not AbstractJob.

If I add the listener manually ie

<listeners>
   <listener ref="taskBatchExecutionListener"/>
</listeners>

in the job xml the problem is fixed.

I have a few questions:

1) Is this a bug in Spring Cloud Task - ie its just not handling XML configuration correctly, if so I can raise an issue for this.

2) Should Spring Cloud Dataflow handle this better? It seems a badly behaved task can effectively corrupt the data and stop retrieval of lists containing 'good' jobs too.

David Geary
  • 1,756
  • 2
  • 14
  • 23

2 Answers2

0

I had the same problem, and in my case the problem was solved by adding @EnableTask to the job configuration

0

I remember getting this error as well, but in my case, I tried deleting a task execution via the spring cloud dataflow server API (see https://docs.spring.io/spring-cloud-dataflow/docs/current-SNAPSHOT/reference/htmlsingle/#api-guide-resources-task-executions-delete).

When I noticed it is actually a NO-OP delete (it does nothing and was confirmed by the developers https://github.com/spring-cloud/spring-cloud-dataflow/issues/1844), I tried manually deleting records from the database, and I missed some records.

There are some FK dependencies and my clean-up was not thorough. Once I started over (created a new DB schema and all) then the issue went away.

Daniel
  • 14,004
  • 16
  • 96
  • 156