'Unexpected Error Occurred' when loading Directories section on Crowd

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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

The Crowd server throws an 'unexpected error occurred' message when Directory section is accessed on the UI.

Cause

The following errors appear in the logs if there are more than one records returns in cwd_synchronisation_status table in the database.

Also, you might see the Crowd directory synchronisation failing too and in the logs we would see the error failed at the findActiveInne method.

2020-09-07 13:24:04,137 http-nio-8095-exec-2 ERROR [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: query did not return a unique result: 2
org.hibernate.NonUniqueResultException: query did not return a unique result: 2
	at org.hibernate.query.internal.AbstractProducedQuery.uniqueElement(AbstractProducedQuery.java:1601)
	at org.hibernate.query.internal.AbstractProducedQuery.uniqueResult(AbstractProducedQuery.java:1571)
	at com.atlassian.crowd.dao.directory.DirectorySynchronisationStatusDAOHibernate.findLastForDirectory(DirectorySynchronisationStatusDAOHibernate.java:36)
	at com.atlassian.crowd.manager.directory.InDatabaseDirectorySynchronisationInformationStore.getLast(InDatabaseDirectorySynchronisationInformationStore.java:60)
	at sun.reflect.GeneratedMethodAccessor889.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)


Bug Information

CWD-5429 - multiple results in cwd_synchronisation_status table cause directory synchronisation failed (fixed in 4.2.0, 4.1.2, 4.0.4 and later)

Workaround

The following steps should do the trick as it will remove the unfinished syncs from the DB:

  1. Shutdown Crowd.
  2. Run the following query against the database where Crowd runs:

    SELECT * FROM cwd_synchronisation_status;
  3. Confirm that rows are shown (all with statuses different than "SUCCESS_FULL")
  4. When confident, run the following query:

    DELETE FROM cwd_synchronisation_status WHERE id IN (<run on each directory ID that is giving us issues>);
  5. Run the following to confirm we now have only one row per directory:

    SELECT * FROM cwd_synchronisation_status;
  6. Start Crowd and check if the issue is resolved.


If the above doesn't help, please do reach out to Atlassian Support for further assistance.

Last modified on Feb 26, 2025

Was this helpful?

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