Workflow index rebuild fails

Steps to reproduce

Steps to reproduce:
1. I am testing the migration from 2.1 to 2.2 (in fact even ferom 1.6 to 2.2 with any major version in between)
2. I have an Opencast 2.1 with 20 jobs inside. I used the DB migration script, I deleted the elastic search index, I rebuild the elastic search index, I deleted all SOLR search indices.
3. When restarting Opencast I see the error in the Code Snippet as a reason, why the Workflow Search index could not be activated.

Actual Results:

Expected Results:

Workaround (if any):


Lukas Rohner
May 17, 2016, 3:42 PM

Hi , I found the issue. The problem is, that the seviceregistry is returning an immutable list of jobs, which was introduced with the JPA update. Even with an iterator you're not allowed anymore to adjust the underlying collection. So to fix this issue you need either to copy the jobs to a new collection and remove it then or filter it upfront. Here a sample how to filter it upfront:

See WorkflowServiceSolrIndex:

if (instancesInSolr == 0) {"The workflow index is empty, looking for workflows to index");
// this may be a new index, so get all of the existing workflows and index them
List<Job> jobs = null;

try {
jobs = $(serviceRegistry.getJobs(WorkflowService.JOB_TYPE, null)).filter(operationIsStartWorkflow).toList();
} catch (ServiceRegistryException e) {
logger.error("Unable to load the workflows jobs: {}", e.getMessage());
throw new ServiceException(e.getMessage());

public static final Fn<Job, Boolean> operationIsStartWorkflow = new Fn<Job, Boolean>() {
public Boolean ap(Job job) {
return WorkflowServiceImpl.Operation.START_WORKFLOW.toString().equals(job.getOperation());

Fixed and reviewed


Rüdiger Rolf


Rüdiger Rolf


Non Functioning