NullPointerException when Adding Labels or Favourites after Upgrading to 3.1 or Later

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

Symptoms

When trying to add a favourite, an error message appears:

1 2 Server error while updating favourite

The following appears in the atlassian-confluence.log:

1 2 3 4 5 6 7 8 9 10 11 12 java.lang.NullPointerException at com.atlassian.confluence.labels.actions.AddFavouriteAction.getCommand(AddFavouriteAction.java:71) at com.atlassian.confluence.labels.actions.AddFavouriteAction.isPermitted(AddFavouriteAction.java:53) at com.atlassian.confluence.core.ConfluenceActionSupport.isPermittedAsString(ConfluenceActionSupport.java:263) at com.atlassian.confluence.security.actions.PermissionCheckInterceptor.intercept(PermissionCheckInterceptor.java:43) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.setup.webwork.BootstrapAwareInterceptor.intercept(BootstrapAwareInterceptor.java:26) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.user.actions.UserAwareInterceptor.intercept(UserAwareInterceptor.java:58)

And:

1 2 3 4 5 ... 2010-01-26 22:31:24,312 INFO [Thread-1] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [services/statusServiceContext.xml] 2010-01-26 22:31:24,328 INFO [Thread-1] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [com/atlassian/confluence/compatibility/compatibility-context.xml] ...

In contrast, a normal startup looks like:

1 2 3 4 2010-01-22 17:29:20,407 INFO [main] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [services/statusServiceContext.xml] 2010-01-22 17:29:20,422 INFO [main] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [services/labelServiceContext.xml] 2010-01-22 17:29:20,438 INFO [main] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from class path resource [com/atlassian/confluence/compatibility/compatibility-context.xml]

Notice that the labelServiceContext appears in the second log but not the first, meaning in the first log it has not loaded.

Cause

Previous versions of <CONFLUENCE_INSTALL>/confluence/WEB-INF/web.xml did not contain the proper configuration, and the label is not loading. Most likely, the problem occurs when the web.xml file has been copied from an old instance into a new during an upgrade.

The default 3.1 web.xml contains:

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 <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:/databaseSubsystemContext.xml, classpath:/services/cacheServiceContext.xml, classpath:/services/bandanaServiceContext.xml, classpath:/services/eventServiceContext.xml, classpath:/services/pluginServiceContext.xml, classpath:/services/taskQueueServiceContext.xml, classpath:/services/permissionsServiceContext.xml, classpath:/applicationContext.xml, classpath:/i18NContext.xml, classpath:/securityContext.xml, classpath:/productionDatabaseContext.xml, classpath:/indexingSubsystemContext.xml, classpath:/searchSubsystemContext.xml, classpath:/rpcSubsystemContext.xml, classpath:/upgradeSubsystemContext.xml, classpath:/wikiSubsystemContext.xml, classpath:/wikiFiltersSubsystemContext.xml, classpath:/velocityContext.xml, classpath:/importExportSubsystemContext.xml, classpath:/schedulingSubsystemContext.xml, classpath:/atlassianUserContext.xml, classpath:/attachmentSubsystemContext.xml, classpath:/services/baseServiceContext.xml, classpath:/services/contentServiceContext.xml, classpath:/services/userServiceContext.xml, classpath:/services/statusServiceContext.xml, classpath:/services/labelServiceContext.xml, classpath:/com/atlassian/confluence/compatibility/compatibility-context.xml, classpath:/jmxContext.xml, classpath:/cacheProviderContext.xml </param-value> </context-param>

Notice that the 3.1 web.xml contains the classpath:/services/labelServiceContext.xml line, which previous installs did not include.

Resolution

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.