"ops - an error has occurred" after configuing DB
Asked by Sergei Kotykhov:

Hello.

I have a problem - unable to start using Confluence. I had a brunch of attemps with different hardware, but no success.

My last system parameters:
> $ free -h  
> total used free shared buff/cache available  
> Mem: 3.9G 3.4G 335M 4.9M 157M 282M  
> Swap: 6.0G 995M 5.0G  
>
> $ uname -a  
> Linux ubuntu 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
>
> $ cat /etc/issue  
> Ubuntu 16.04.4 LTS \\n \\l

mysql version is 5.7.

Mysql options (from mysqld.cnf):
> character-set-server=utf8  
> collation-server=utf8_bin  
> default-storage-engine=INNODB  
> innodb_log_file_size=2GB  
> transaction-isolation=READ-COMMITTED  
> binlog_format=row  
> max_allowed_packet = 256M

.

After configuring Mysql server i created mysql databse and user, made "grant all..." as described in document [Database Setup For MySQL](https://confluence.atlassian.com/doc/database-setup-for-mysql-128747.html). Later a ran ./atlassian-confluence-6.10.0-x64.bin, choose "n" to question "run confluence now?". After that i copied mysql-connector-java-5.1.46-bin.jar to confluence/lib, and made cd confluence/bin; ./start-confluence.sh.

Confluence started normally, and it became available at ipaddr:8090. After that i succssfully go throw configuration master up to page with database configuration. A filled all fields, clicked "check connection" (connection check to db was passed), and later confluence took a big pause... nothing happened for a very long time, but suddenly page with error appeared.

> Oops - an error has occurred. {#toc-hId-1819283545}
> ---------------------------------------------------
>
> Cause
>
> java.lang.IllegalStateException: Cannot call sendError() after the response has been committed  
> at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:456)
>
> #### Stack Trace:\[hide\] {#toc-hId--1125900426}
>
> java.lang.IllegalStateException: Cannot call sendError() after the response has been committed at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:456) at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120) at com.atlassian.confluence.web.filter.DebugFilter$LoggingResponseWrapper.sendError(DebugFilter.java:132) at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120)

Logs contain strings like this:

```
03-Jul-2018 01:00:12.190 WARNING [ContainerBackgroundProcessor[StandardEngine[Standalone]]] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDetected Thread [http-nio-8090-exec-3] (id=[40]) 
has been active for [62,302] milliseconds (since [7/3/18 12:59 AM]) to serve the same request for [http://d1.cclever.ru:8090/setup/setupdbtype.action] and may be stuck (configured threshold for this StuckThreadD
etectionValve is [60] seconds). There is/are [1] thread(s) in total that are monitored by this Valve and may be stuck.
 java.lang.Throwable
 at java.util.zip.ZipFile.open(Native Method)
 at java.util.zip.ZipFile.<init>(ZipFile.java:225)
 at java.util.zip.ZipFile.<init>(ZipFile.java:155)
 at java.util.jar.JarFile.<init>(JarFile.java:166)
 at java.util.jar.JarFile.<init>(JarFile.java:130)
 at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:164)
 at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:149)
```

\[skip...\]

```
 at java.lang.Thread.run(Thread.java:748)

03-Jul-2018 01:04:16.280 SEVERE [http-nio-8090-exec-5] org.apache.catalina.core.StandardHostValve.custom Exception Processing ErrorPage[errorCode=500, location=/500page.jsp]
 org.apache.jasper.JasperException: An exception occurred processing [/500page.jsp] at line [120]

117: 
118: if (sysInfoService != null)
119: {
120: confluenceInfo = sysInfoService.getConfluenceInfo();
121: memoryInfo = sysInfoService.getMemoryInfo();
122: dbInfo = sysInfoService.getSafeDatabaseInfo();
123: sysinfo = GeneralUtil.convertBeanToMap(sysInfoService.getSystemProperties());


Stacktrace:
 at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:593)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:482)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
```

Does anybody have an idea how to fix this error? One interesting fact. I have created vps with the same version on ubuntu and the same ammount of RAM, and confluence installation was successful. But I could not repeat this on other machines.


Answers:
author: R. Fuerst
body: Hi Sergei,

The steps you describe appear to be the correct steps to take to install Confluence. Additionally, Confluence doesn't require too much by way of the operating system - it can run on any flavor of Linux and you appear to have enough resources.

The only thing that I spotted that might cause an issue here would be your MySQL driver version: mysql-connector-java-5.1.46-bin.jar.

Per the [JDBC documentation](https://confluence.atlassian.com/doc/database-jdbc-drivers-171742.html ), Confluence has been tested with the 5.1.42 driver.

Moving forward, to rule out an issue with the driver, I suggest shutting down Confluence, removing the original jar file and copying in the 5.1.42 driver. Then try starting Confluence and try to go through the setup wizard again.

comments: author: Sergei Kotykhov
body: Hi Rachel, thank you for answer.

I tried mysql connector 5.1.42, and still have no positive result.

The first web page I saw after confluence started was the page with System Error.

```
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-1622882349}

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--1125788117}

```
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)
```

BTW, one of my attemps was point Confluence to use internal database. Result was the same - system error. So, mysql connector is not the reason.

Look at my log please at first 2 line - there are some errors with "SystemInformationService". Can this service be the reason? May be some important information on my system is not available, and this service don't check it gracefully and falls with an exception? What information is retrieved by this service?


author: R. Fuerst
body: Hi Sergei,

It looks like we made some progress, since there's a new error thrown. The new error indicates that your file permissions for the Confluence home directory might be incorrect.

You'll want to make sure that the permissions are set properly, and then try starting Confluence again.

Full details on the error and the proper permissions are outlined in the documentation below:

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

Hope it helps!

Rachel


author: Sergei Kotykhov
body: Thank you, Rachel. I have news. After full reinstall with mysql-connector 5.1.42 Cofluence works! But only after full reinstall. I tried just to replace mysql connector from 5.1.46 to 5.1.42, and nothing was changed (of cause Confluence was restarted).

But I am absolutely sure there is some magic, because I tried a lot of times to config Confluence with built-in database (in this case mysql-connector is not loaded, right?), and no success happend.

As for permissions, I tried to play with it before (with no success). But when we install Confluence from .sh-bundle, permission must be set properly, right?

Nevertheless, Confluence is working now, I'm happy now. Thank you again!


Tags: confluence-server

server