Jira server throws DirectoryNotFoundException after migration from Cloud
Symptoms
The following error appears in atlassian-jira.log
during a directory sync:
015-02-10 20:35:21,387 atlassian-scheduler-quartz1.clustered_Worker-3 ERROR [com.atlassian.scheduler.JobRunnerResponse] Unable to synchronise directory
com.atlassian.crowd.exception.DirectoryNotFoundException: Directory <2> does not exist
at com.atlassian.jira.crowd.embedded.JiraDirectorySynchroniser.runJob(JiraDirectorySynchroniser.java:71)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
In this case, the directory id is 2. This is needed for the resolution
Cause
During migration from Cloud to Server, the internal directory used for cloud authentication was not automatically deleted. A fix for this is being tracked in - JRA-43223Getting issue details... STATUS .
Resolution
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
The orphaned synchronization job will need to be manually deleted from the database with the following queries:
- Identify the directory that is causing the errors.
- In the stack trace above, we see that the Directory ID is "2"
Using the found ID, remove the orphaned entries from the database:
delete from jquartz_triggers where trigger_name = 'com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.2'; delete from jquartz_simple_triggers where trigger_name = 'com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.2'; delete from clusteredjob where job_id = 'com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.2';
Note the '2' id used at the end of the query. Ensure to replace this with the proper ID as indicated by the error message of your system.