NullPointerException during space import due to cache management

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

Note that this KB was created for the Data Center version of the product. Data Center KBs 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

Summary

The Space import procedure throws a java.lang.NullPointerException on the UI, no further details are shown.

Diagnosis

Looking for references at the atlassian-confluence.log, the following stack is present during Space import: 

1 2 3 com.atlassian.confluence.importexport.ImportExportException: java.lang.NullPointerException -- url: /admin/restore.action | referer: http://localhost:8080/admin/backup.action | traceId: 9fd02f1661b206f0 | userName: test | action: restore 2021-03-18 17:19:18,829 ERROR [Long running task: Importing data] [confluence.importexport.actions.ImportLongRunningTask] runInternal Failure during import
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2021-03-18 17:19:18,815 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.BackupImporter] importEntities Cannot import the entities: -- url: /admin/restore.action | referer: http://localhost:8080/admin/backup.action | traceId: 9fd02f1661b206f0 | userName: test | action: restore java.lang.NullPointerException at com.atlassian.cache.hazelcast.HazelcastHybridCache.isFlushable(HazelcastHybridCache.java:311) at com.atlassian.cache.impl.AbstractCacheManager.flushCaches(AbstractCacheManager.java:103) ... Caused by: java.lang.NullPointerException at com.atlassian.cache.hazelcast.HazelcastHybridCache.isFlushable(HazelcastHybridCache.java:311) at com.atlassian.cache.impl.AbstractCacheManager.flushCaches(AbstractCacheManager.java:103) at com.atlassian.confluence.cache.hazelcast.ConfluenceHazelcastCacheManager.flushCaches(ConfluenceHazelcastCacheManager.java:93) at com.atlassian.confluence.impl.cache.hibernate.HibernateClusterAwareCacheManager.flushCaches(HibernateClusterAwareCacheManager.java:91) at java.base/java.util.ArrayList.forEach(Unknown Source) at com.atlassian.confluence.impl.cache.CacheFlusher.lambda$createCompositeCacheFlusher$0(CacheFlusher.java:37) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.postProcess(BackupImporter.java:466) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:402) ... 38 more

If you find this stack trace, it is very likely that when you try to flush the cache or access the Cache Statistics page, you observe the following errors: 

  • Flush the cache on the Confluence node first via the REST API endpoint will fail with HTTP status code 500 Internal Server Error:

1 curl -u <adminUsername>:<adminPassword> -X DELETE "http://CONFLUENCE_URL/rest/cacheManagement/1.0/cacheEntries"
  • Trying to access the Cache Statistic page throws "Fetch of cache statistics failed":

1 http://CONFLUENCE_URL/admin/cache/showStatistics.action
(Auto-migrated image: description temporarily unavailable)

Cause

We are hitting into this issue of java.lang.NullPointerException due to cache management. This appears to be caused by corrupted caches on the affected Confluence node.

Solution

Please, follow the steps below to address the issue: 

  1. Stop the Confluence node where the space import is failing

  2. Follow the steps in KB How to clear Confluence plugins cache on this specific Confluence node

  3. Restart the Confluence node and try the Space Import again

Updated on March 19, 2025

Still need help?

The Atlassian Community is here for you.