Confluence Activity Stream Macro throws NullPointerException

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

Problem

When trying to add an Activity Stream Macro to your Confluence page, you might end up with an error in the preview that an error has occurred. When inspecting the application logs, you will find the following error:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 2018-07-31 21:21:51,234 ERROR [http-nio-8090-exec-97 url:/confluence/rest/activity...sername:admin ] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: null -- referer: http://localhost:8090/confluence/plugins/servlet/gadgets/ifr?container=atlassian&mid=14789791842304&country=GB&lang=en&view=default&view-params=%7B%22writable%22%3A%22true%22%7D&st=atlassian%3A1rzSScqAqH4Py8vkgmTxJjO%sdsaf2BoA2ik8fV3Q19keecO6lcbCwnYyEz%2FMbsdsdsXh5Ww4jjoDgXIGNxEHprZsbYr%2BVtkOgZTZ2xJJjkrXPfbYzDhqXQffdfdI%2FRRa2%2BpOn2egjjtv5NbT1zOC7XH3NVmXnuNw8GW1GRDjj3PUOa9d1aI7ASkYb2G2%2BPqrxzobQVph5g%2Fw2mF7Ife38rWb8IeHIG5BY6P2XGsRQPUOTerIRiXuDN9P3Zbc2caJu7TDZB2vrFaS%2BRmJ49pjilvdn45qvI3O6hn%2B%2FTx4E%2FEiE1j1MF3361BvRLWuN9O5V0ny%2BuG6DwzstQ9GmRpEjcll83094xj0tNaLUmkx9%2BkQHmzOFh8e85um2wf%2F3xvX%2FekFinlw%2BxnY%2BcjKSlebV3uxtYIgh6YM99HFPXAyKuBJBaprJ2%2BKmKWSGZMFD%2Bfs&up_isConfigured=true&up_isReallyConfigured=false&up_title=Activity+Stream&up_titleRequired=true&up_numofentries=10&up_refresh=false&up_maxProviderLabelCharacters=50&up_rules=&up_renderingContext=&up_keys=&up_itemKeys=&up_username=&url=https%3A%2F%2Fconfluence.oraclecorp.com%2Fconfluence%2Frest%2Fgadgets%2F1.0%2Fg%2Fcom.atlassian.streams.confluence%3Aactivitystream-gadget%2Fgadgets%2Fconf-activitystream-gadget.xml&libs=auth-refresh | url: /confluence/rest/activity-stream/1.0/config | traceId: cee048918e1cd6 | userName: admin java.lang.NullPointerException at com.atlassian.streams.confluence.SpaceKeys$3.compare(SpaceKeys.java:88) at com.atlassian.streams.confluence.SpaceKeys$3.compare(SpaceKeys.java:74) at com.google.common.collect.ComparatorOrdering.compare(ComparatorOrdering.java:38) at java.util.TimSort.binarySort(TimSort.java:296) at java.util.TimSort.sort(TimSort.java:239) at java.util.Arrays.sort(Arrays.java:1438) at com.google.common.collect.Ordering.sortedCopy(Ordering.java:817) at com.atlassian.streams.confluence.SpaceKeys$2.doInTransaction(SpaceKeys.java:68) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21) at com.atlassian.sal.spring.component.SpringHostContextAccessor$1.doInTransaction(SpringHostContextAccessor.java:71) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at com.atlassian.sal.spring.component.SpringHostContextAccessor.doInTransaction(SpringHostContextAccessor.java:68) at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.access$001(ConfluenceSpringHostContextAccessor.java:21) at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.lambda$doInTransaction$3(ConfluenceSpringHostContextAccessor.java:72) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71) at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.doInTransaction(ConfluenceSpringHostContextAccessor.java:72) at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy298.doInTransaction(Unknown Source) at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:136) at com.sun.proxy.$Proxy298.doInTransaction(Unknown Source) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy1171.execute(Unknown Source) at com.atlassian.streams.confluence.SpaceKeys.fetchSpaces(SpaceKeys.java:62) at com.atlassian.streams.confluence.SpaceKeys.spaceKeys(SpaceKeys.java:43) at com.atlassian.streams.confluence.SpaceKeys.get(SpaceKeys.java:38)

Diagnosis

In order to diagnose this issue, you can look into the application logs found by default in

<confluence-home>/logs/atlassian-confluence.log

Cause

The root cause of this issue is due to a missing Space Name for one of the spaces. Normally it is not possible to have space without a space name. However, in the case of a manual update on the database that was done by mistake or any other reasons, then you will have to manually update the name of the problematic space.

Solution

Resolution

Please run the following query to identify the problematic space(s)

1 SELECT * FROM SPACES where SPACENAME is null;

If the above query returns any results, then run the following update on the database

Make sure to take a database backup before applying any modifications

1 UPDATE SPACES SET SPACENAME='SOME_SPACE_NAME' WHERE SPACEID = <SOME_SPACEID>;

If you don't have auto-commit on your database, make sure to commit the updates so they persist on the database.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.