confluence database setup
Asked by Anthony Eghobor:

I am trying to setup confluence on first loading the site after installation. I am using the evaluation license because I am doing this in test environment before I move it to live. I put the license in, click next, and in the db page , I put the url to the external database which is MySQL 5.6 , username and password in and it starts to do something and eventually I get the message below. By the way this is confluence 6.2.0

**"*504 Gateway Time-out"***

***If I load the page in another tab , I get the below error***

***"The following error(s) occurred:Error recording default paths to system."***

When I refresh the 504 page , I get the error message below

***"System error***

***Cause***

***com.atlassian.config.ConfigurationException: Unable to register MBean \[com.atlassian.confluence.jmx.TaskQueueWrapper@5b8a4f45\] with key 'Confluence:name=MailTaskQueue'; nested exception is javax.management.InstanceAlreadyExistsException: Confluence:name=MailTaskQueue
at com.atlassian.confluence.setup.actions.AbstractSetupAction.transitionFromColdToVacantState(AbstractSetupAction.java:161)***

***caused by: org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean \[com.atlassian.confluence.jmx.TaskQueueWrapper@5b8a4f45\] with key 'Confluence:name=MailTaskQueue'; nested exception is javax.management.InstanceAlreadyExistsException: Confluence:name=MailTaskQueue
at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625)***

***caused by: javax.management.InstanceAlreadyExistsException: Confluence:name=MailTaskQueue
at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)"***

Stopped and started confluence and I get the error message below after

***"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***

***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)"***

I have been on this for more than a week, I have checked permissions to where confluence lives, made sure confluence is running as confluence and other checks I cannot remember now. When I check the database, the database is there and tables have been created. So confused.


Answers:
author: AnnWorley
body: Hi Anthony,

For the first error:

```
caused by: javax.management.InstanceAlreadyExistsException: Confluence:name=MailTaskQueue
 at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)" 
```

if it comes back, please disable JMX as described in [Unable to Start Confluence Due to JMX](https://confluence.atlassian.com/confkb/unable-to-start-confluence-due-to-jmx-182158269.html)

For the other one:

```
caused by: java.lang.IllegalStateException: Spring Application context has not been set
```

there are 10 possible causes in [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), I am betting on # 10. The resolution in that case is:

1.
   > Stop Confluence.
2.
   > Delete the \<confluence-home\>/confluence.cfg.xml file.
3.
   > Start Confluence.
4.
   > Access the Base URL in your browser to start the Setup Wizard from the beginning.
5.
   > During the database configuration step, choose "Continue and overwrite existing data" if prompted.
6.
   > Make sure all the steps are completed successfully.

I look forward to hearing if the setup wizard works when you go through it again.

Thanks,

Ann

comments: author: Anthony Eghobor
body: Thanks Ann, sorry I am only coming back now, I have been on leave. This has not worked for me , pretty much the same issue. The only difference is when I tried to load the url after getting 504, I got the below

"Load Content

If you are evaluating or demonstrating Confluence, or are introducing Confluence to users who are new to the idea of a Wiki, we **recommend the example site** as the best way to become acquainted with what Confluence can do for you. More experienced users will want to start with an empty site, or restore a backup of their own.

Example Site {#toc-hId-1793482398}
----------------------------------

**Recommended:** Load the 'Demonstration Space' to begin working with Confluence immediately.

Empty Site {#toc-hId--758674563}
--------------------------------

Start with an empty site. After finishing the setup you will need to create at least one space before you can add any content of your own.

Restore From Backup {#toc-hId-984135772}
----------------------------------------

Use data from another installation of Confluence. If you are migrating to another database or replicating Confluence you will probably want to select this option."

I believe it can access the db as I got the message to choose to overwrite data or not which is step 5 . Any more suggestions will be highly appreciated.

Thanks

Anthony


author: Anthony Eghobor
body: That setup prompt is when I try the url in another tab after 504, but when I refresh the 504 page, I get pretty much the same sequence of error messages I explained in the original post. Thanks .Anthony


author: AnnWorley
body: I hope I am understanding correctly. It sounds like you can get to the "Load Content" step which definitely indicates the database is being written to. What happens if you choose Example Site or Empty Site and proceed? Th expected behavior is the setup wizard should continue to completion.

Were you able to follow the steps to disable JMX as described in [Unable to Start Confluence Due to JMX](https://confluence.atlassian.com/confkb/unable-to-start-confluence-due-to-jmx-182158269.html)?


author: Anthony Eghobor
body: Hi Ann, I didnt have o disable JMX because it doesn't happen the second time. But I can give that a go just to make sure I eliminate the possibility of it being the issue. I will get back to you on Monday. Thanks for your help. Anthony


author: AnnWorley
body: Thanks for keeping me in the loop. I am confident we can get Confluence installed successfully. Have a great weekend!


author: Anthony Eghobor
body: Hi Ann, I upgraded confluence to 6.6.1, and now I see a friendlier interface for db setup.I chose the connection string option rather than the simple one. I had setup my database RDS parameter group as below but still gave me error that it is not using the correct character encoding:

"Family" : "mysql5.6",

"Parameters" : {

"character_set_client" : "utf8",

"character_set_connection" : "utf8",

"character_set_database" : "utf8",

"character_set_results" : "utf8",

"character_set_server" : "utf8",

"collation_connection" : "utf8_bin",

"collation_server" : "utf8_bin"

Anyway, for diagnosis sake I manually ran mysql commands in the database to change it and now when I test connection , I get "Your database must use 'READ-COMMITTED' as the default isolation level". I am still checking how to do that in RDS or maybe directly in the database so as to ascertain it is the cause of the problems I have been having. Any ideas


author: AnnWorley
body: This article describes setting the isolation level for MySQL: [Confluence fails to start and throws 'MySQL session isolation level 'REPEATABLE-READ' is no longer supported' error](https://confluence.atlassian.com/confkb/confluence-fails-to-start-and-throws-mysql-session-isolation-level-repeatable-read-is-no-longer-supported-error-241568536.html)

These queries for making sure the collation and character set in MySQL have been tested thoroughly; is this the guide you followed?

[How to Fix the Collation and Character Set of a MySQL Database](https://confluence.atlassian.com/confkb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-670958160.html)

Looking forward to hearing of your progress.