Confluence Error (missing field external_id)
Asked by krejcim:

I updated confluence and jira on my machine and JIRA is working just fine, but confluence now gives an error in tomcat. I even restored my backups that were working before the upgrade, but now even they won't work. All I get now is a long error in my browser and error log, I don't understand why even a restore does this now:

I am running 64-bit linux version and I completly restored the /opt/atlassian/confluence, the var/atlassian/application-data/confluence directory and the full database which was backed up right before the update and was working then.

```
org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Unable to perform find; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'this.external_id' in 'field list'	org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:97)	org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)	org.springframework.orm.hibernate.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:364)	org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:351)	org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)	org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.internalFindUser(HibernateUserDao.java:472)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.internalFindByName(HibernateUserDao.java:449)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.findByName(HibernateUserDao.java:429)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao$1.apply(CachedCrowdUserDao.java:76)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao$1.apply(CachedCrowdUserDao.java:71)	com.atlassian.confluence.cache.option.OptionalReadThroughCache.get(OptionalReadThroughCache.java:33)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao.findUser(CachedCrowdUserDao.java:136)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao.findByName(CachedCrowdUserDao.java:158)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy35.findByName(Unknown Source)	com.atlassian.crowd.directory.AbstractInternalDirectory.findUserByName(AbstractInternalDirectory.java:149)	com.atlassian.crowd.directory.AbstractInternalDirectory.findUserByName(AbstractInternalDirectory.java:60)	com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.findUserByName(DirectoryManagerGeneric.java:298)	com.atlassian.crowd.manager.application.ApplicationServiceGeneric.findUserByName(ApplicationServiceGeneric.java:290)	com.atlassian.crowd.embedded.core.CrowdServiceImpl.getUser(CrowdServiceImpl.java:93)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy39.getUser(Unknown Source)	com.atlassian.crowd.embedded.atlassianuser.EmbeddedCrowdUserManager.getUser(EmbeddedCrowdUserManager.java:107)	com.atlassian.confluence.user.ConfluenceUserManager.getUser(ConfluenceUserManager.java:63)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy40.getUser(Unknown Source)	bucket.user.DefaultUserAccessor.getUser(DefaultUserAccessor.java:154)	com.atlassian.confluence.user.DefaultUserAccessor.getUserByName(DefaultUserAccessor.java:214)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy50.getUserByName(Unknown Source)	com.atlassian.confluence.user.ConfluenceAuthenticator.getUser(ConfluenceAuthenticator.java:130)	com.atlassian.confluence.user.ConfluenceAuthenticator.getUser(ConfluenceAuthenticator.java:29)	com.atlassian.seraph.auth.DefaultAuthenticator.getUserFromCookie(DefaultAuthenticator.java:437)	com.atlassian.seraph.auth.DefaultAuthenticator.getUser(DefaultAuthenticator.java:327)	com.atlassian.confluence.user.ConfluenceAuthenticator.getUser(ConfluenceAuthenticator.java:135)	com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:125)	com.atlassian.confluence.web.filter.ConfluenceSecurityFilter.doFilter(ConfluenceSecurityFilter.java:28)	com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:150)	com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)	com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:41)	com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.ConfluenceJohnsonFilter.handleError(ConfluenceJohnsonFilter.java:40)	com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:63)	org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)	com.atlassian.spring.filter.FlushingSpringSessionInViewFilter.doFilterInternal(FlushingSpringSessionInViewFilter.java:29)	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)	com.atlassian.confluence.util.ConfluenceErrorFilter.doFilter(ConfluenceErrorFilter.java:22)	com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:99)	com.atlassian.confluence.core.datetime.RequestTimeThreadLocalFilter.doFilter(RequestTimeThreadLocalFilter.java:35)	com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:80)	com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:51)	com.atlassian.core.filters.cache.AbstractCachingFilter.doFilter(AbstractCachingFilter.java:33)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)	com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter.doFilter(RequestParamValidationFilter.java:58)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.filter.TranslationModeFilter.doFilter(TranslationModeFilter.java:43)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.plugin.servlet.filter.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:71)	com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:53)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:25)	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:65)
```

**root cause**

```
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'this.external_id' in 'field list'	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)	sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)	java.lang.reflect.Constructor.newInstance(Unknown Source)	com.mysql.jdbc.Util.handleNewInstance(Util.java:406)	com.mysql.jdbc.Util.getInstance(Util.java:381)	com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1051)	com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)	com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)	com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)	com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)	com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2693)	com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2102)	com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2261)	com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)	net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)	net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)	net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)	net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)	net.sf.hibernate.loader.Loader.doList(Loader.java:1063)	net.sf.hibernate.loader.Loader.list(Loader.java:1048)	net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)	net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3675)	net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)	net.sf.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:385)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao$2.doInHibernate(HibernateUserDao.java:477)	org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)	org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.internalFindUser(HibernateUserDao.java:472)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.internalFindByName(HibernateUserDao.java:449)	com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.findByName(HibernateUserDao.java:429)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao$1.apply(CachedCrowdUserDao.java:76)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao$1.apply(CachedCrowdUserDao.java:71)	com.atlassian.confluence.cache.option.OptionalReadThroughCache.get(OptionalReadThroughCache.java:33)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao.findUser(CachedCrowdUserDao.java:136)	com.atlassian.confluence.user.crowd.CachedCrowdUserDao.findByName(CachedCrowdUserDao.java:158)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy35.findByName(Unknown Source)	com.atlassian.crowd.directory.AbstractInternalDirectory.findUserByName(AbstractInternalDirectory.java:149)	com.atlassian.crowd.directory.AbstractInternalDirectory.findUserByName(AbstractInternalDirectory.java:60)	com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.findUserByName(DirectoryManagerGeneric.java:298)	com.atlassian.crowd.manager.application.ApplicationServiceGeneric.findUserByName(ApplicationServiceGeneric.java:290)	com.atlassian.crowd.embedded.core.CrowdServiceImpl.getUser(CrowdServiceImpl.java:93)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy39.getUser(Unknown Source)	com.atlassian.crowd.embedded.atlassianuser.EmbeddedCrowdUserManager.getUser(EmbeddedCrowdUserManager.java:107)	com.atlassian.confluence.user.ConfluenceUserManager.getUser(ConfluenceUserManager.java:63)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy40.getUser(Unknown Source)	bucket.user.DefaultUserAccessor.getUser(DefaultUserAccessor.java:154)	com.atlassian.confluence.user.DefaultUserAccessor.getUserByName(DefaultUserAccessor.java:214)	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	java.lang.reflect.Method.invoke(Unknown Source)	org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)	org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)	com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	com.sun.proxy.$Proxy50.getUserByName(Unknown Source)	com.atlassian.confluence.user.ConfluenceAuthenticator.getUser(ConfluenceAuthenticator.java:130)	com.atlassian.confluence.user.ConfluenceAuthenticator.getUser(ConfluenceAuthenticator.java:29)	com.atlassian.seraph.auth.DefaultAuthenticator.getUserFromCookie(DefaultAuthenticator.java:437)	com.atlassian.seraph.auth.DefaultAuthenticator.getUser(DefaultAuthenticator.java:327)	com.atlassian.confluence.user.ConfluenceAuthenticator.getUser(ConfluenceAuthenticator.java:135)	com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:125)	com.atlassian.confluence.web.filter.ConfluenceSecurityFilter.doFilter(ConfluenceSecurityFilter.java:28)	com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:150)	com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)	com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:41)	com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.ConfluenceJohnsonFilter.handleError(ConfluenceJohnsonFilter.java:40)	com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:63)	org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)	com.atlassian.spring.filter.FlushingSpringSessionInViewFilter.doFilterInternal(FlushingSpringSessionInViewFilter.java:29)	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)	com.atlassian.confluence.util.ConfluenceErrorFilter.doFilter(ConfluenceErrorFilter.java:22)	com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:99)	com.atlassian.confluence.core.datetime.RequestTimeThreadLocalFilter.doFilter(RequestTimeThreadLocalFilter.java:35)	com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:80)	com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:51)	com.atlassian.core.filters.cache.AbstractCachingFilter.doFilter(AbstractCachingFilter.java:33)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)	com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter.doFilter(RequestParamValidationFilter.java:58)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.filter.TranslationModeFilter.doFilter(TranslationModeFilter.java:43)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.plugin.servlet.filter.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:71)	com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:53)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:25)	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:65)
```


Answers:
author: Remo Siegwart
body: Here's what we usually do when one of our customers has this problem:

**Check database character set and collation**

Execute the following query to check the current character set and collation of the Confluence database (replace '\<database_name\>' with the name of your Confluence database):

```
SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '&lt;database_name&gt;';
```

The default character set should be **utf8** and the default collation **utf8_bin**. If that's not the case, execute the following query to fix this (replace '\<database_name\>' with the name of your Confluence database):

```
ALTER DATABASE &lt;database_name&gt; CHARACTER SET utf8 COLLATE utf8_bin;
```

**Check character set and collation of all tables**

Execute the following query to find tables using the wrong character set and/or collation (replace '\<database_name\>' with the name of your Confluence database):

```
SELECT t.table_name, c.character_set_name, c.collation_nameFROM information_schema.TABLES t, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY cWHERE c.collation_name = t.table_collation AND t.table_schema = '&lt;database_name&gt;'AND (c.character_set_name != 'utf8' OR c.collation_name != 'utf8_bin');
```

If the query returned any results, you can execute the following query for every table in the results to convert them to character set **utf8** and collation **utf8_bin** (replace '\<table_name\>' with the name of one of the tables from the results):

```
ALTER TABLE &lt;table_name&gt; CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
```

I personally usually use the following query to generate all the statements for all tables in a single query (replace '\<database_name\>' with the name of your Confluence database):

```
SET SESSION group_concat_max_len = 1000000;SELECT GROUP_CONCAT(CONCAT('ALTER TABLE ', t.table_schema, '.', t.table_name, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;') SEPARATOR '\n') as stmtFROM information_schema.TABLES t, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY cWHERE c.collation_name = t.table_collation AND t.table_schema = '&lt;database_name&gt;'AND (c.character_set_name != 'utf8' OR c.collation_name != 'utf8_bin');
```

Now you just need to copy the result and execute the whole string to convert all tables in a single statement.

**UPDATE:**

If you are running into errors related to foreign key constraints when executing the ALTER TABLE statements, you may need to temporary disable foreign key checks:

```
SET foreign_key_checks = 0;&lt;insert your ALTER TABLE statements here&gt;SET foreign_key_checks = 1;
```

Hope this helps

Cheers  
Remo

comments: author: Nils Kohlstrom
body: Works perfect!

Another way but from command line:

```
mysql --database=&lt;database_name&gt; -B -N -e "SHOW TABLES" | awk '{print "ALTER TABLE", $1, " CHARACTER SET = utf8 ;  "}' | mysql --database=&lt;database_name&gt;
```


author: Maik Diepenbroek
body: Thanks, worked like a charm!


author: Harun Bar?? Bulut
body: If I should have seen this before I do the steps :)


author: Roman Gavrilov
body: I've just upgraded from 5.1.5 to 5.3 and getting this error, enabling mysql logs reveals that confluence looks for externa_id field in the cwd_user table. There is no such field in my cwd_user table.

Am I missing schema update or change?

please help


author: krejcim
body: I was able to fix my problem. It had to do with an expired license and for some reason I wasn't getting the message about the expired license running confluence via a port forward. But ran I ran it directly from the server it was installed in I got the out of date license error. Once I fixed that everything worked fine.

comments: author: Steve Guns
body: The solution is indeed the license issue. I have the same problem. Why would using confluence over a port forward make a difference here. They should really look into that!


author: Artem Grotskyi
body: That was exactly what I faced to.  
Mike, thank you for sharing this solution!

<br />

I think Atlassian should add this case to their KB. As it is pretty much common problem.


author: Maxym Mykhalchuk
body: Hello,

Check your Confluence logs for "Detected tables with non-default character encoding/collation". If yes, follow the link it suggests <https://confluence.atlassian.com/pages/viewpage.action?pageId=392888396>

It helped here having the same error after upgrade to 5.3.1

Best,  
Maxym


author: Scott Larson
body: I ran into this issue, but it was actually a case of some tables having their collation set to utf8_general_ci despite the DB having been created with utf8_bin. Run 'show table status' in your Confluence DB to see if any are set to something other than utf8_bin. If there are you can then fix it by doing the following for each affected table.

```
alter table &lt;table_name&gt; convert to character set utf8 collate utf8_bin;
```

comments: author: Lee Wang-soo
body: How can I determine a collation of tables?


author: mwclark4453
body: The alter table command is giving me errors on several tables that have foreign key constraints. How did everyone get around that? Best option I've seen so far is to drop the constraint, do the convert and then put it back. Not pretty.


author: James P. Hilving
body: Adding to Mike Clark's findings....this worked for us.

SET foreign_key_checks = 0;

alter table \<table_name\> convert to character set utf8 collate utf8_bin;

SET foreign_key_checks = 1;


author: Matthias Linhuber
body: I've exactly the same problem when updating vom 5.2.5 to 5.3 .

Has anyone a solution ?!

No one of the mentioned solution issues above could help us!!!


author: Lee Wang-soo
body: Same error when upgrading from 5.1.2 to 5.3


author: krejcim
body: I was able to fix my problem. It had to do with an expired license and for some reason I wasn't getting the message about the expired license running confluence via a port forward. But ran I ran it directly from the server it was installed in I got the out of date license error. Once I fixed that everything worked fine.


author: Mathias Lieber
body: Same problem here!