Confluence fails to start after upgrade due to 'NoSuchBeanDefinitionException'
Symptoms
After completing the instructions Upgrading Confluence, Confluence fails to start with a NoSuchBeanDefinitionException exception:
011-04-08 19:12:32,577 ERROR [main] [springframework.web.context.ContextLoader] initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'pluginStateStore' while setting constructor argument with index 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginStateStore' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'bandanaManager' while setting bean property 'bandanaManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaManager' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'bandanaPersister' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionalCacheFactory' while setting bean property 'cacheFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionalCacheFactory' defined in class path resource [services/cacheServiceContext.xml]: Cannot resolve reference to bean 'cacheManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginStateStore' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'bandanaManager' while setting bean property 'bandanaManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaManager' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'bandanaPersister' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionalCacheFactory' while setting bean property 'cacheFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionalCacheFactory' defined in class path resource [services/cacheServiceContext.xml]: Cannot resolve reference to bean 'cacheManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaManager' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'bandanaPersister' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionalCacheFactory' while setting bean property 'cacheFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionalCacheFactory' defined in class path resource [services/cacheServiceContext.xml]: Cannot resolve reference to bean 'cacheManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionalCacheFactory' while setting bean property 'cacheFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionalCacheFactory' defined in class path resource [services/cacheServiceContext.xml]: Cannot resolve reference to bean 'cacheManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionalCacheFactory' defined in class path resource [services/cacheServiceContext.xml]: Cannot resolve reference to bean 'cacheManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
Cause
The previous version's web.xml file was copied manually. With new versions of Confluence the web.xml will be updated with new spring contexts.
If you copy an old version of the web.xml file, it will be missing these contexts and you would get the above error.
Resolution
If you have customized your web.xml, instead of replacing the web.xml, edit the default web.xml and apply your customizations to the new install's default web.xml file.