NullPointerException when Adding Labels or Favourites after Upgrading to 3.1 or Later
症状
When trying to add a favourite, an error message appears:
Server error while updating favourite
atlassian-confluence.log
に次のエラーが返される。
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:
...
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:
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.
原因
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:
<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.
ソリューション