NonUniqueResultException が原因で Confluence スペースにアクセスできない
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
要約
In Confluence 8.3 or newer, a space can't be accessed or searched by any user, including the space owner. This can also happen in macros and apps that list space directories.
The logs show this error: NonUniqueResultException: query did not return a unique result
.
In Confluence 8.2 or older, the Space Directory appears, but affected spaces are not in the list. If you try to directly access an affected space using a URL, you'll get a "Page not found" error.
Inaccessible space resolution
Due to a manual SQL UPDATE
, INSERT
, or other activity performed on the database server, the database has multiple rows with the same LOWERSPACEKEY
value. There could also be a mismatch between SPACEKEY
and LOWERSPACEKEY
. As a result, Confluence can't find a unique row for the space. The solution is to check for duplicate or mismatched space entries, flush the caches in case the node has cached invalid space data, and then update the incorrect SPACES
row in the database if necessary.
Check for duplicate LOWERSPACEKEY values
First, check for inconsistencies by running these queries.
Check for incorrect
LOWERSPACEKEY
values:SELECT * FROM SPACES WHERE lowerspacekey <> LOWER(spacekey)
SELECT * FROM dbo.SPACES WHERE lowerspacekey <> LOWER(spacekey);
Check for duplicate LOWERSPACEKEY values:
SELECT lowerspacekey, COUNT(*) FROM SPACES GROUP BY lowerspacekey HAVING COUNT(*) >= 2
Flush the cache and repair the spaces table
If either of these queries return rows, follow these steps.
- Flush all of the Confluence caches.
- Navigate to General Configuration > Cache Management.
- Click the Flush All button.
- After flushing the cache, try to access the space.
- If the issue persists, do these steps during your next maintenance window.
Confluence を終了します。
- Backup your database.
Run this SQL statement:
UPDATE spaces SET LOWERSPACEKEY = LOWER(spacekey) where LOWERSPACEKEY='<LOWERSPACEKEY>' ;
Replace <
LOWERSPACEKEY>
with the Confluence space key that has the mismatch.- Run the diagnostic queries again. If the problem persists, you might need to rename or delete one of the duplicate space key rows.
- Confluence を起動します。
Here is more detail on the error in the atlassian-confluence.log
file.
2023-08-18 19:14:37,752 ERROR [http-nio-8080-exec-144 url: /display/SPACE_NAME, /spaces/viewspace.action; user: admin] [apache.struts2.dispatcher.DefaultDispatcherErrorHandler] sendErrorResponse Exception occurred during processing request: query did not return a unique result: 5
-- url: /display/SPACE_NAME | userName: npa| traceId: 7bb5bc0d626fab89
org.hibernate.NonUniqueResultException: query did not return a unique result: 5
at com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.uniqueResult(HibernateObjectDao.java:587)
...
...
The unique result count can be other numbers.