MySQL Migration Failed
Asked by Chris Lo:

Hello Support,

We are trying to do a migration from the embedded database in Confluence to a MySQL server in the network that is hosting JIRA as well. The process worked out fine until the setup process was trying to setup the necessary database in the MySQL. During the process, Confluence crashed and make it unreachable. From the traceback of the logs, it says "Container is not setup". Can someone take a look into the traceback and let me know what went wrong in the first place please? For your reference, I have attached the logs below:  

### Cause {#toc-hId-1626550490}

java.lang.RuntimeException: javax.servlet.ServletException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getResources' in class com.atlassian.confluence.plugin.webresource.DefaultConfluenceWebResourceManager threw exception com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Container is not setup at /decorators/setup.vmd\[line 9, column 25\]  
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:37)

caused by: javax.servlet.ServletException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getResources' in class com.atlassian.confluence.plugin.webresource.DefaultConfluenceWebResourceManager threw exception com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Container is not setup at /decorators/setup.vmd\[line 9, column 25\]  
at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator$ErrorSendingErrorHandlingStrategy.handleException(ConfluenceSitemeshDecorator.java:244)

caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getResources' in class com.atlassian.confluence.plugin.webresource.DefaultConfluenceWebResourceManager threw exception com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Container is not setup at /decorators/setup.vmd\[line 9, column 25\]  
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)

caused by: com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Container is not setup  
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)

caused by: java.lang.IllegalStateException: Container is not setup  
at com.atlassian.spring.container.LazyComponentReference.create(LazyComponentReference.java:41)

I have the complete log - including the stack trace. Please let me know if you need it.

<br />

Thank you,

Chris


Answers:
author: Shannon S
body: Chris,

Can you let me know the exact steps you took to migrate the database? You'll want to be sure you're following exactly the [Migrating to Another Database](https://confluence.atlassian.com/doc/migrating-to-another-database-148867.html) procedure and that the MySQL database is setup exactly per [Database Setup for MySQL](https://confluence.atlassian.com/doc/database-setup-for-mysql-128747.html). This can commonly cause those errors if there is any difference in setup.

Let us know also your Confluence version and MySQL version.

Regards,

Shannon

comments: author: Frank Tam
body: Hello Shannon,

The Confluence I am running on is v6.10.1 and the MySQL version is 5.6.40.

Here is the steps I took to when migrating the database:

1. make a copy of Confluence home directory at /var/atlassian/application-data/confluence.
2. rename the Confluence home directory.
3. setup the database based on the "database setup for MySQL" documentation.
4. run the install script and confirmed that the install completed successfully.
5. goto http://\<jira-hostname\>:8090
6. proceed to the page where you can configure database, and click "Next" once the database test completed successfully.

Expected Result: The setup script should setup the tables in the database I designated and completed successfully.

Actual Result: It crashed with the error message I submitted.


author: Shannon S
body: Thank you, Frank.

Can you confirm which MySQL driver you installed?

Please also review the steps at [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).

Regards

Shannon


author: Chris Lo
body: Hello Shannon,

The MySQL driver version (If i get it correctly) is 8.0.11-1.el7.

I believe I have do most of the things listed in the "Spring Application" document you provided, but let me go through once again.

Also I have the track dump as well. If you need that for troubleshooting purpose, please let me know.

Thank you,

Chris


author: Shannon S
body: Hi Chris,

I'm so sorry for the delay, I must have missed the notification. I assume you may have resolved it at this point, but if not, please have a look at the following.

Per [Database JDBC Drivers](https://confluence.atlassian.com/doc/database-jdbc-drivers-171742.html):
> Confluence is currently tested with the **5.1.42** driver.
>
> The latest driver (8.x) is not currently supported.

Please [download the driver from here](https://dev.mysql.com/downloads/connector/j/5.1.html).

Let me know if that helps! If not, I can create a support ticket and you can submit the dump there.

Regards,

Shannon


Tags: confluence-server

server