Email notifications trigger a NoSuchElementException in the logs

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.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Email notifications work, but throw exceptions in the logs. The following appears in the atlassian-confluence.log:

2015-05-07 13:41:30,354 ERROR [NotificationSender:thread-2] [plugin.notifications.dispatcher.NotificationErrorRegistryImpl] addError Error sending notification to server '<Unknown>'(-1) for INDIVIDUAL task (resent 4 times): Error generating message for server 'System Mail' on medium 'mail' for user 'ff808181442f17b001442f198675309b'.
NoSuchElementException: 
 -- referer: https://localhost:8090/confluence/pages/editpage.action?pageId=360452 | url: /pages/doeditpage.action | userName: admin | action: doeditpage | page: 360452

Diagnosis

Environment

  • Users are sourced from Active Directory (or possibly another LDAP system)

Diagnostic Steps

  • Check the status of the user mentioned in the error. Is the user currently active or disabled? 

Cause

The error is thrown because the user, which is synchronized from Active Directory (or another external LDAP), is no longer active and has been disabled in LDAP, and by extension in Confluence. However, the user is still subscribed to page or space notifications, and being disabled does not remove those subscriptions. Confluence continues to try to send notifications to that user, and because the user is now disabled, it triggers a NoSuchElement exception.

Resolution

Remove the space/page watches that the disabled user is subscribed to. You can do this by querying the notifications table in the database:

  • Confirm that the disabled user is subscribed to notifications. Using the user key from the error:

    SELECT * FROM notifications where username = 'ff808181442f17b001442f198675309b';
    
  • Delete that user's notifications:

    DELETE FROM notifications WHERE username = 'ff808181442f17b001442f198675309b';
    

    Always back up your database before performing any modification to the database. If possible, try your modifications on a test server.

  • Clear the Confluence caches at Confluence Administration > Cache Management, or restart Confluence.

Last modified on Jun 10, 2021

Was this helpful?

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