HTTP Status 500 - java.lang.IllegalStateException: Spring Application context has not been set
Asked by hgorazd:

Hello.

After upgrading confluence 6.4.x \> 6.5 and rebooting the server, we're getting this error <http://intranet.hostko.si:8090/errors.jsp> (installation is always made as root and in Linux OS).

Current permissions:

/opt/atlassian/:  
total 2.0G  
drwxr-xr-x 3 root root 4.0K Jun 5 12:29 .  
drwxr-xr-x. 3 root root 4.0K Jan 9 13:40 ..  
-rw-r--r-- 1 root root 586M Jan 9 17:53 2018_01_09-confluence-6.0.7-back.zip  
-rw-r--r-- 1 root root 827M Jun 5 11:31 2018_06_05-confluence-6.0.7-back.zip  
-rw-r--r-- 1 root root 615M Jun 5 12:27 2018_06_05-confluence-6.4.0-back.zip  
-rw-r--r-- 1 root root 203 Jun 5 11:28 6.0.7-modifications.txt  
-rw-r--r-- 1 root root 203 Jun 5 12:20 6.4.0-modifications.txt  
drwxr-xr-x 14 root root 4.0K Jun 5 12:47 confluence

/opt/atlassian/confluence/  
drwxr-xr-x 14 root root 4.0K Jun 5 12:47 .  
drwxr-xr-x 3 root root 4.0K Jun 5 12:29 ..  
drwxr-xr-x 3 root root 4.0K Jun 5 12:29 bin  
drwxr-xr-x 3 root root 4.0K Jun 5 12:29 conf  
drwxr-xr-x 27 root root 4.0K Jun 5 12:29 confluence  
drwxr-xr-x 3 root root 4.0K Jun 5 12:47 .install4j  
-rw-r--r-- 1 root root 82K Jun 5 12:47 install.reg  
drwxr-xr-x 4 root root 4.0K Jun 5 12:29 jre  
drwxr-xr-x 2 root root 4.0K Jun 5 12:29 lib  
-rw-r--r-- 1 root root 57K May 1 14:20 LICENSE  
drwxr-xr-x 2 root root 68K Jun 5 12:29 licenses  
drwx------ 2 confluence root 4.0K Jun 11 05:31 logs  
-rw-r--r-- 1 root root 1.5K May 1 14:20 NOTICE  
-rw-r--r-- 1 root root 2.3K May 1 14:20 README.html  
-rw-r--r-- 1 root root 1.2K May 1 14:20 README.txt  
-rw-r--r-- 1 root root 6.9K May 1 14:20 RELEASE-NOTES  
-rw-r--r-- 1 root root 17K May 1 14:20 RUNNING.txt  
drwxr-xr-x 4 root root 4.0K Jun 5 12:29 synchrony-proxy  
drwx------ 3 confluence root 4.0K Jun 5 13:20 temp  
-rwx------ 1 root root 11K May 1 14:20 uninstall  
drwxr-xr-x 2 root root 4.0K May 1 14:20 webapps  
drwx------ 3 confluence root 4.0K Jun 7 14:07 work

How can we fix this problem?

Thank you.

Gorazd


Answers:
author: Moses Thomas
body: [@hgorazd](/t5/user/viewprofilepage/user-id/1470035)I don't see any error in the logs which you have provided.

Do not run Confluence as **root** , and ensure that the user running Confluence has **full read and write access to the home folder**

You will need to give the user "**confluence"**for instance running confluence permission to run this file.

There are many ways to do this, but i suggest this.

1. add user(confluence) to the ownership group

    go to where you have the startup confluence script in mine its here  opt/atlassian/confluence/bin enter the command  ls - al ( you will  see the owner group of the file start-confluence.sh)use the commandsudo usermod -a -G groupname username

2. then execute the command( recursively giving executable permission including all subfiles)

```
 chmod -R +xr /opt/atlassian/confluence/bin
```

Best!


author: Danyal Iqbal
body: It seems that you are starting confluence as the root user. This is not allowed. Please reconsider.


author: Moses Thomas
body: [@hgorazd](/t5/user/viewprofilepage/user-id/1470035)Try resolution stated here

<https://confluence.atlassian.com/confkb/confluence-does-not-start-due-to-spring-application-context-has-not-been-set-218278311.html?_ga=2.201254951.862002052.1528701485-340601725.1511879849>

Best!

comments: author: hgorazd
body: started /opt/atlassian/confluence/bin/start-confluence.sh -fg and saw the error was hostname mismatch so fixed that but I get this error:

Confluence had failed to start, but we're back up and running again  
\> Take me to my Confluence home.  
\> Finishing up checks

Regards,

Gorazd


author: Moses Thomas
body: [@hgorazd](/t5/user/viewprofilepage/user-id/1470035)You should be able to login into confluence are you able ?


author: hgorazd
body: Not yet. I'm still at the same screen and the starting is not showing any serious errors.

Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out  
---------------------------------------------------------------------------  
Using Java: /opt/atlassian/confluence/jre//bin/java  
2018-06-12 08:00:19,666 INFO \[main\] \[atlassian.confluence.bootstrap.SynchronyProxyWatchdog\] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required  
---------------------------------------------------------------------------  
Using CATALINA_BASE: /opt/atlassian/confluence  
Using CATALINA_HOME: /opt/atlassian/confluence  
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp  
Using JRE_HOME: /opt/atlassian/confluence/jre/  
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar  
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid  
12-Jun-2018 08:00:20.122 WARNING \[main\] org.apache.tomcat.util.digester.SetPropertiesRule.begin \[SetPropertiesRule\]{Server} Setting property 'debug' to '0' did not find a matching property.  
12-Jun-2018 08:00:20.203 WARNING \[main\] org.apache.catalina.startup.SetAllPropertiesRule.begin \[SetAllPropertiesRule\]{Server/Service/Connector} Setting property 'debug' to '0' did not find a matching property.  
12-Jun-2018 08:00:20.216 WARNING \[main\] org.apache.tomcat.util.digester.SetPropertiesRule.begin \[SetPropertiesRule\]{Server/Service/Engine} Setting property 'debug' to '0' did not find a matching property.  
12-Jun-2018 08:00:20.223 WARNING \[main\] org.apache.tomcat.util.digester.SetPropertiesRule.begin \[SetPropertiesRule\]{Server/Service/Engine/Host} Setting property 'debug' to '0' did not find a matching property.  
12-Jun-2018 08:00:20.282 WARNING \[main\] org.apache.tomcat.util.digester.SetPropertiesRule.begin \[SetPropertiesRule\]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.  
12-Jun-2018 08:00:20.313 WARNING \[main\] org.apache.tomcat.util.digester.SetPropertiesRule.begin \[SetPropertiesRule\]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.  
12-Jun-2018 08:00:20.679 INFO \[main\] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler \["http-nio-8090"\]  
12-Jun-2018 08:00:20.703 INFO \[main\] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read  
12-Jun-2018 08:00:20.707 INFO \[main\] org.apache.catalina.startup.Catalina.load Initialization processed in 696 ms  
12-Jun-2018 08:00:20.718 INFO \[main\] org.apache.catalina.core.StandardService.startInternal Starting service Tomcat-Standalone  
12-Jun-2018 08:00:20.718 INFO \[main\] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.51  
12-Jun-2018 08:00:23.351 INFO \[localhost-startStop-2\] org.apache.catalina.core.ApplicationContext.log Spring WebApplicationInitializers detected on classpath: \[com.atlassian.synchrony.proxy.SynchronyDispatcherServletInitializer@182128de\]  
2018-06-12 08:00:23,659 INFO \[localhost-startStop-1\] \[com.atlassian.confluence.lifecycle\] contextInitialized Starting Confluence 6.5.3 \[build 7502 based on commit hash 4a7eac426e5ef07034950de31bee1c5d626e2ea1\] - synchrony version 2.1.0-release-confluence_6.5-8d720dbe  
2018-06-12 08:00:27,512 INFO \[localhost-startStop-1\] \[atlassian.confluence.cluster.DefaultClusterConfigurationHelper\] lambda$populateExistingClusterSetupConfig$1 Populating setup configuration if running with Cluster mode...  
12-Jun-2018 08:00:42.725 INFO \[localhost-startStop-2\] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'dispatcher'  
12-Jun-2018 08:00:42.726 INFO \[localhost-startStop-2\] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization started  
12-Jun-2018 08:00:42.732 INFO \[localhost-startStop-2\] org.springframework.web.context.support.AnnotationConfigWebApplicationContext.prepareRefresh Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date \[Tue Jun 12 08:00:42 CEST 2018\]; root of context hierarchy  
12-Jun-2018 08:00:42.809 INFO \[localhost-startStop-2\] org.springframework.web.context.support.AnnotationConfigWebApplicationContext.loadBeanDefinitions Registering annotated classes: \[class com.atlassian.synchrony.proxy.websocket.WebSocketConfig,class com.atlassian.synchrony.proxy.web.SynchronyWebMvcConfig\]  
12-Jun-2018 08:00:43.462 INFO \[localhost-startStop-2\] org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler.initialize Initializing ExecutorService 'defaultSockJsTaskScheduler'  
12-Jun-2018 08:00:43.534 INFO \[localhost-startStop-2\] org.springframework.web.socket.server.support.WebSocketHandlerMapping.registerHandler Mapped URL path \[/v1/bayeux-sync1\] onto handler of type \[class org.springframework.web.socket.server.support.WebSocketHttpRequestHandler\]  
12-Jun-2018 08:00:43.766 INFO \[localhost-startStop-2\] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{\[/reload\],methods=\[PUT\]}" onto public org.springframework.http.ResponseEntity com.atlassian.synchrony.proxy.web.SynchronyProxyRestController.reloadConfiguration(com.atlassian.synchrony.proxy.web.SynchronyProxyConfigPayload)  
12-Jun-2018 08:00:43.768 INFO \[localhost-startStop-2\] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{\[/healthcheck\]}" onto public com.atlassian.synchrony.proxy.web.HealthCheckResult com.atlassian.synchrony.proxy.web.SynchronyProxyRestController.getSynchronyProxyInfo()  
12-Jun-2018 08:00:43.805 INFO \[localhost-startStop-2\] org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandler Mapped URL path \[/\*\*\] onto handler of type \[class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler\]  
12-Jun-2018 08:00:44.241 INFO \[localhost-startStop-2\] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date \[Tue Jun 12 08:00:42 CEST 2018\]; root of context hierarchy  
12-Jun-2018 08:00:44.451 INFO \[localhost-startStop-2\] org.springframework.context.support.DefaultLifecycleProcessor.start Starting beans in phase 2147483647  
12-Jun-2018 08:00:44.489 INFO \[localhost-startStop-2\] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization completed in 1763 ms

Regards,

<br />

Gorazd


Tags: confluence-server

server