Confluence does not start due to Spring Application context has not been set
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
On Confluence Startup, the following error is thrown:
2010-06-18 21:54:45,432 INFO [main] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve 2010-06-18 21:55:20,515 FATAL [http-8080-1] [atlassian.spring.container.SpringContainerContext] getComponent Spring Application context has not been set 2010-06-18 21:55:20,528 ERROR [http-8080-1] [[Standalone].[localhost].[/].[action]] log Servlet.service() for servlet action threw exception java.lang.IllegalStateException: Spring Application context has not been set at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:48) at com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:32) at com.atlassian.confluence.security.seraph.ConfluenceElevatedSecurityGuard.getCaptchaManager(ConfluenceElevatedSecurityGuard.java:115)
This error may also be thrown:
15-Nov-2015 23:57:33.447 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Tomcat-Standalone 15-Nov-2015 23:57:33.447 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.28 2015-11-15 23:57:45,736 INFO [localhost-startStop-1] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 5.8.16 [build 5996 based on commit hash 4a6343ec7ed8542179d6c78fa7f87c01f81da016] 15-Nov-2015 23:58:06.434 SEVERE [Standalone-startStop-1] org.apache.catalina.startup.HostConfig.start Unable to create directory for deployment: /opt/atlassian/confluence/conf/Standalone/localhost
This error may also be thrown:
java.util.concurrent.CompletionException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantedTransactionManager' defined in class path resource [databaseSubsystemContext.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantedLocalSessionFactoryBean5' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: premature SessionFactory initialisation, Hibernate properties have not yet been persisted in confluence.cfg.xml
or during installation after a restart
2016-11-30 12:23:12,241 ERROR [http-nio-8090-exec-3] [confluence.util.profiling.ConfluenceSitemeshErrorDecorator] renderInternal Failed to render error decorator. Falling back to using no decorator -- traceId: 006cacff18fcfffe javax.servlet.ServletException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLocale' in class com.atlassian.confluence.core.ConfluenceActionSupport threw exception java.lang.IllegalStateException: Spring Application context has not been set at /decorators/includes/header.vm[line 58, column 41]
- The user running Confluence does not have write permissions to the home folder defined in
<install>/confluence/WEB-INF/classes/confluence-init.propertiesor the install directory.
- You are running Confluence as the
rootuser or if you have an application firewall enabled (SeLinux or AppArmor).
- The database driver is not located in the
<install>/confluence/WEB-INF/libfolder or you are using a database version that is incompatible with the bundled driver.
- The hostname of the server can not be resolved.
- The server does not have enough memory during installation to set up the database, and restarts return this error.
- After upgrading the OS, the installation directory might become defective.
- The Confluence database is not configured correctly with permissions.
- The file <confluence-home>/confluence.cfg.xml is corrupt.
- When running a Data Center distribution and the network interface configured in the affected node is different than the one used in the other nodes.
- Confluence is actively being monitored by a health check from a load balancer, other users are accessing confluence or other browser tabs are refreshing confluence base URL.
The Setup Wizard requires fulfilling a certain number of steps. For whatever reason, the Confluence instance has been stopped or the server has been restarted before finishing all the steps of the Setup Wizard.
Each step can be identified by checking the URL in the web browser. A typical Confluence installation would go through the following URLs (they may vary depending on the options you choose):
Do not run Confluence as root, and ensure that the user running Confluence has full read and write access to the home folder. This can be set by running
chmod -R with the appropriate permissions, to apply them recursively to each subfolder. An example of the right permissions would be:
sudo chown -R <confluence-user> <confluence-install-folder> sudo chown -R <confluence-user> <confluence-home-folder> sudo chmod -R u=rwx,g=rx,o=rx <confluence-install-folder> sudo chmod -R u=rwx,g=rx,o=rx <confluence-home-folder>
The user confluence is only a suggestion. You can change it for another username.
- Right-click the <Confluence Home> Folder
- Select Properties
- Select Security
- Add the user that is being used to run Confluence with full read and write access
If even with the right permissions you still are facing issues, check out this documentation to verify if there is a SeLinux or AppArmor enabled.
Check the Supported Platforms and Database JDBC Drivers pages and verify that the required driver is located under <install>/confluence/WEB-INF/lib and your database version is compatible with the Confluence version.
The hostname you are using must be resolvable (try
ping $HOSTNAME). E.g. The hostname
localhost has not been added to
/etc/hosts . See java.net.UnknownHostException exceptions in Confluence log file due to DNS lookups failing.
Confirm your server has enough physical memory to run the JVM. Confluence 6.0 requires 2GB. Before re-starting the installer, restart the Setup Wizard by following the steps outlined in Resolution 10.
Reinstall Confluence using a new installation directory and a different home directory. Check if the folder permission for the installer and home directories are correct. Check if the UI comes up as expected using the new installation directory and after finishing the setup, stop confluence and modify the <install>/confluence/WEB-INF/classes/confluence-init.properties file pointing to the old home directory. Save the file and start the application again.
It is recommended that the database user is the owner of the Confluence database. When using PostgreSQL, the user has to be the owner of the Confluence database. Oracle, MySQL, and MSSQL need only the necessary permissions.
<confluence-home>/confluence.cfg.xml file needs to be properly formatted. It can be checked using online tools like W3 School XML Validator or advanced editors like IntelliJ or Eclipse. The file might have some hidden characters like "space" in the wrong place (e.g before the opening <?xml....> or some elements might not be closed properly which can break the XML file format.
Please note that
confluence.cfg.xml can hold sensitive information (e.g. passwords) and because of that, we advise you to remove them (sensitive information) prior to testing it with online tools.
The interface name might have been named in a different order for the affected server compared to the others, which means that an interface named eth2 in one server could be the same interface that is named eth3 in another server.
In this case, we'll need to find out which interface is the correct one on the affected server. Please, follow the resolution steps outlined in this KB article to find it out, then change the confluence.cfg.xml file to use the proper network interface: https://confluence.atlassian.com/confkb/hazelcast-cannot-start-on-this-node-no-matching-network-interface-found-646447553.html
It is recommended that only one Browser window is connected to Confluence during the initial installation wizard and that no other user or health check is targeting Confluence instance. Multiple open browser windows will be polling the Server for a status update which may affect the Setup and result in a Spring Context error as per - CONFSERVER-59084Getting issue details... STATUS
If this is a fresh installation, you can use the steps below to restart the installation. This will completely wipe the original instance and data in the database.
Backup and delete the <confluence-home>/confluence.cfg.xml file.
Access the Base URL in your browser to start the Setup Wizard from the beginning.
During the database configuration step, choose "Continue and overwrite existing data" if prompted.
- Make sure all the steps are completed successfully.