Jira startup fails with Multiple entries with same key error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Symptoms

An exception due to multiple entries with the same key can cause Jira to either fail to start or fail to send Service Management Notifications.

1. Jira fails to start and display this message:

From Jira_Home/log/atlassian-jira.log, this error is thrown:

2016-01-31 17:02:42,744 localhost-startStop-1 ERROR      [c.a.jira.startup.LauncherContextListener] Unable to start Jira.
java.lang.IllegalArgumentException: Multiple entries with same key: AutomationRule-2=Sun Jan 31 00:00:00 SGT 2016 and AutomationRule-2=Sun Jan 18 00:00:00 SGT 2015
	at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150)
	at com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104)
	at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:70)
	at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254)
	at com.atlassian.jira.scheduler.OfBizClusteredJobDao.refresh(OfBizClusteredJobDao.java:111)
	at com.atlassian.scheduler.caesium.impl.SchedulerQueueImpl.refreshClusteredJobsFromDao(SchedulerQueueImpl.java:139)
	at com.atlassian.scheduler.caesium.impl.SchedulerQueueImpl.refreshClusteredJobsUnderLock(SchedulerQueueImpl.java:130)
	at com.atlassian.scheduler.caesium.impl.SchedulerQueueImpl.refreshClusteredJobs(SchedulerQueueImpl.java:117)
	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.refreshClusteredJobs(CaesiumSchedulerService.java:319)
	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.startImpl(CaesiumSchedulerService.java:245)
	at com.atlassian.jira.scheduler.JiraCaesiumSchedulerService.startImpl(JiraCaesiumSchedulerService.java:36)
	at com.atlassian.scheduler.core.AbstractSchedulerService.start(AbstractSchedulerService.java:180)
	at com.atlassian.jira.scheduler.JiraSchedulerLauncher.proceedIfAllClear(JiraSchedulerLauncher.java:41)
	at com.atlassian.jira.scheduler.JiraSchedulerLauncher.start(JiraSchedulerLauncher.java:27)
	at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:55)
	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$499(DefaultJiraLauncher.java:134)
	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$16/878583859.run(Unknown Source)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194)
	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:121)
	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$497(DefaultJiraLauncher.java:90)
	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$2/679677406.run(Unknown Source)
	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:88)
	at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:79)
	... 5 filtered
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

2. Service Management Notifications fail to send

2017-10-23 16:56:16,738 Jira-Bootstrap ERROR      [c.a.jira.scheduler.JiraSchedulerLauncher] A RuntimeException occurred during JiraSchedulerLauncher servlet context initialisation - Multiple entries with same key: sd.custom.notification.batch.send=Fri Oct 20 10:26:48 CEST 2017 and sd.custom.notification.batch.send=Fri Oct 20 10:26:48 CEST 2017.
java.lang.IllegalArgumentException: Multiple entries with same key: sd.custom.notification.batch.send=Fri Oct 20 10:26:48 CEST 2017 and sd.custom.notification.batch.send=Fri Oct 20 10:26:48 CEST 2017

both are related to  JRASERVER-64325 - Getting issue details... STATUS

Diagnosis

  • According to the error message above, there are 2 entries with the same key AutomationRule-2
  • These entries are stored in the clusteredjob table in the Jira database:
    • One has next_run scheduled on Sun Jan 31 00:00:00 SGT 2016
    • The other has next_run scheduled on Sun Jan 18 00:00:00 SGT 2015

      Example keys below

      Multiple entries with same key: AutomationRule-2=Sun Jan 31 00:00:00 SGT 2016 and AutomationRule-2=Sun Jan 18 00:00:00 SGT 2015

      Or

      Multiple entries with same key: sd.custom.notification.batch.send=Fri Oct 20 10:26:48 CEST 2017 and sd.custom.notification.batch.send=Fri Oct 20 10:26:48 CEST 2017
  • This SQL query identifies the entries:

    select * from clusteredjob where job_id = 'AutomationRule-2';

    replace AutomationRule-2 with the job_id found in the error message

  • The outcome might look like:

Cause

The duplicate entry causes Jira not to start up properly.

The entry whose  ID  is older should be deleted.

tip/resting Created with Sketch.

In this case, it's the one that reads AutomationRule-2 (the ID is 10020).

Resolution

  • Shut down Jira and back up the database properly

  • Delete the problematic entry:

    delete from clusteredjob where id = 10020;

    replace 10020 with the ID found in the Diagnosis section and evaluated according to the Cause section

    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.

  • Restart Jira

DescriptionAn exception due to multiple entries with the same key can cause Jira to either fail to start or fail to send Service Management Notifications.
ProductJira
PlatformServer
Last modified on Nov 23, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.