NullPointerException during space import due to cache management

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

Summary

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

Diagnosis

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

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
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 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:
curl -u <adminUsername>:<adminPassword> -X DELETE "http://CONFLUENCE_URL/rest/cacheManagement/1.0/cacheEntries"
  • Trying to access the Cache Statistic page it throws "Fetch of cache statistics failed":
http://CONFLUENCE_URL/admin/cache/showStatistics.action


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


Last modified on May 22, 2024

Was this helpful?

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