Error starting docker confluence
Asked by Florin Moraru:

Hi,

I am trying to set up confluence docker with nginx running on host.

The confluence docker image (latest) has the shared volume

```
/var/atlassian/application-data/confluence
```

and has the usual 8090 amd 8091 ports exposed.

The server configuration has

```
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
           maxThreads="48" minSpareThreads="10"
           enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
           protocol="org.apache.coyote.http11.Http11NioProtocol"
           proxyName="c.domain.com" proxyPort="443" scheme="https" />
```

And nginx has

```
server {
  listen 80;
  listen [::]:80;
  server_name c.domain.com;
  return 301 https://$http_host$request_uri;
}


server {
        server_name c.domain.com;

        listen   443 default ssl;
        ssl_certificate     /etc/letsencrypt/live/c.domain.com/cert.pem;
        ssl_certificate_key /etc/letsencrypt/live/c.domain.com/privkey.pem;

        ssl_session_timeout  5m;

        ssl_protocols  SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;

    location /confluence {
        proxy_read_timeout      600s;
        proxy_connect_timeout   600s;
        client_max_body_size 100m;
        proxy_buffering off;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8090/confluence;
    }
    location /synchrony {
        proxy_read_timeout      600s;
        proxy_connect_timeout   600s;
        client_max_body_size 100m;
        proxy_buffering off;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8091/synchrony;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}
```

I am using postgres 9.6 docker image over an overlay network.   

I am facing a strange issue, and I try many many options, but all failed.

The step after configuring the database is showing

```
[crit] 1314#0: *905 open() "/var/lib/nginx/tmp/proxy/3/01/00000000[XX]" failed (13: Permission denied) while reading upstream, client: 82.11.145.144, server: c.domain.com, request: "GET /confluence/s/202a4eb254bd334279a734425f2367bc-CDN/en_GB/7502/85262de2dab440f060366aadca149a69d65c1f59/d4a55925e8f9ebab3ed0ef9de12081e3/_/download/contextbatch/js/_super/batch.js?locale=en-GB HTTP/1.1", upstream: "http://127.0.0.1:8090/confluence/s/202a4eb254bd334279a734425f2367bc-CDN/en_GB/7502/85262de2dab440f060366aadca149a69d65c1f59/d4a55925e8f9ebab3ed0ef9de12081e3/_/download/contextbatch/js/_super/batch.js?locale=en-GB", host: "c.domain.com", referrer: "https://c.domain.com/confluence/setup/setupdata-start.action"
```

And the page is not rendered correctly( missing the css files).

If I restart the container, the service prints only the following

The SystemInformationService could not be retrieved from the container. Therefore very limited information is available in this error report.   
The SystemInformationService could not be retrieved due to the following error: java.lang.IllegalStateException: Spring Application context has not been set

### Cause {#toc-hId-1592235014}

com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Spring Application context has not been set  
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)

caused by: java.lang.IllegalStateException: Spring Application context has not been set  
at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:48)

#### Stack Trace:\[hide\] {#toc-hId--1156435452}

```
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Spring Application context has not been set	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)	at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)	at com.atlassian.confluence.setup.webwork.ConfluenceXWorkTransactionInterceptor.getTransactionManager(ConfluenceXWorkTransactionInterceptor.java:28)	at com.atlassian.xwork.interceptors.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:56)	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)	at com.atlassian.confluence.xwork.SetupIncompleteInterceptor.intercept(SetupIncompleteInterceptor.java:38)	[...]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)	at java.lang.Thread.run(Thread.java:748)Caused by: 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:33)	at com.atlassian.confluence.util.LazyComponentReference$Accessor.get(LazyComponentReference.java:42)	at com.atlassian.util.concurrent.Lazy$Strong.create(Lazy.java:85)	at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:325)	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143)	... 195 more        
```

### Referer URL {#toc-hId-782888388}

Unknown

...

I checked writes permissions, they are fine they are all owned by daemon.  
I added javamelody jar, as suggested in one post. no changes  
I increased the nginx timeout, as the database setup step was returning 502, and in one post someone suggested that such failure might create issues.   

This can be reproduced using a VM running nginx, and docker with postgres 9.6 and atlassian/confluence-server:latest ( from 28 Jan 2018)/  

Can someone help me with some suggestions ?

Regards


Answers:
author: Shannon S
body: Hi Florin,

While I don't have much experience on working with Confluence in Docker, the Spring Application error can meant a lot of things. I would start with the list here:

* [Confluence does not start due to Spring Application context has not been set](https://confluence.atlassian.com/confkb/confluence-does-not-start-due-to-spring-application-context-has-not-been-set-218278311.html)

Let me know if you have any questions while going through the solutions.

Regards,

Shannon

comments: author: Shannon S
body: Florin,

Apologies for the delay. This works on a regular Docker VM for me, but I had our resident NGINX expert spin one up, and he ran into the same issue as you.

It doesn't seem to be an issue with Confluence specifically but rather the exact setup you're using. We'll need to determine what exactly Confluence is looking for there, so I have created a bug so we can have a developer investigate.

* [CONFSERVER-54894](https://jira.atlassian.com/browse/CONFSERVER-54894)

Please feel free to update the ticket with your personal experience and details in a comment. You can watch on it for any further updates.

Regards,

Shannon


author: Florin Moraru
body: Hi Shannon,

Thank you. I will keep an close eye on the ticket.  
I will update with comments as soon as I have some sort of progress.   
Regards,   
Florin