Error while upgrading Confluence 5.1.5 -> 5.2.3
Asked by PROSTEP AG:

Im trying to upgrade our Confluence from 5.1.5 to 5.2.3 but i always get the following error below. Any Ideas whats wrong? We're using MySQL.

```
2013-08-19 14:06:43,772 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Unsuccessful: alter table FOLLOW_CONNECTIONS add constraint FK_FOLLOW_CONNECTIONS_FOLLOWER foreign key (FOLLOWER) references user_mapping (user_key)2013-08-19 14:06:43,772 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Can't create table 'confluence.#sql-ae3_b107' (errno: 150)2013-08-19 14:06:43,773 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute could not complete schema updatejava.sql.SQLException: Can't create table 'confluence.#sql-ae3_b107' (errno: 150)        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687)        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)        at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)        at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:167)        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:161)        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:134)        at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:144)        at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:50)        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)        at org.apache.catalina.core.StandardService.start(StandardService.java:525)        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)2013-08-19 14:06:43,827 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: com.atlassian.config.ConfigurationException: Cannot update schemacom.atlassian.confluence.upgrade.UpgradeException: com.atlassian.config.ConfigurationException: Cannot update schema        at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:164)        at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:50)        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)        at org.apache.catalina.core.StandardService.start(StandardService.java:525)        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)Caused by: com.atlassian.config.ConfigurationException: Cannot update schema        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:165)        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:134)        at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:144)        ... 16 moreCaused by: java.sql.SQLException: Can't create table 'confluence.#sql-ae3_b107' (errno: 150)        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687)        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)        at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)        at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:167)        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:161)        ... 18 more2013-08-19 14:06:43,830 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1 errors were encountered during upgrade:2013-08-19 14:06:43,830 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1: Cannot update schema2013-08-19 14:06:43,830 WARN [main] [atlassian.confluence.plugin.PluginFrameworkContextListener] contextInitialized Not starting full plugin system due to upgrade or licensing errors2013-08-19 14:06:44,472 INFO [main] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve
```

```

```

```

```


Answers:
author: Mark Symons
body: The answer seems to be [here](https://jira.atlassian.com/browse/CONF-30380).

There's a couple of possible causes and the linked issue explains how to diagnose which it is and provides workarounds.

comments: author: hsuhailah
body: Adding to this, there are two reasons why it happened:

1. Wrong storage engine (MyISAM as opposed to InnoDB) or/and
2. Wrong collation - the recommended collation is utf8_bin

It's important to go through the diagnosis section to determine if you'll need to apply workaround #1 or #2 or both. These workarounds can be done on the pre upgrade database.


author: PROSTEP AG
body: Thank you guys!


author: Rodrigo Girardi Adami
body: Hello Tim,

It seems that you are running into a known bug: <https://jira.atlassian.com/browse/CONF-30380>

Unfortunately it wasn't fixed yet however there are some workarounds in the bug report that you might try.

I hope this helps!

Rodrigo