Cannot read fields and unknown tables in information_schema
Asked by Riccardo Cinti:

Hello,

After a Confluence installation I'm seeing few errors in the application log related to the 'AO_.\*' tables and I can't add any new content.

Following, part of the log:

```
2018-04-20 14:19:23,270 ERROR [Caesium-1-3] [impl.schedule.caesium.JobRunnerWrapper] runJob Scheduled job com.atlassian.sal.core.scheduling.DefaultPluginScheduler#DefaultPluginScheduler:com.atlassian.mywork.host.batch.NotificationCleanerTask:job failed to run
com.atlassian.activeobjects.internal.ActiveObjectsInitException: bundle [com.atlassian.mywork.confluence-host-plugin]
 at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects$1$1$1.call(TenantAwareActiveObjects.java:95)
 at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects$1$1$1.call(TenantAwareActiveObjects.java:86)
 at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)
 at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$1(VCacheRequestContextOperations.java:59)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Could not read fields for table AO_9412A1_AONOTIFICATION
 at net.java.ao.schema.helper.DatabaseMetaDataReaderImpl.getFields(DatabaseMetaDataReaderImpl.java:139)
 at net.java.ao.schema.ddl.SchemaReader.readFields(SchemaReader.java:126)
 at net.java.ao.schema.ddl.SchemaReader.readTable(SchemaReader.java:110)
 at net.java.ao.schema.ddl.SchemaReader.access$000(SchemaReader.java:62)
 at net.java.ao.schema.ddl.SchemaReader$1.apply(SchemaReader.java:99)
 at net.java.ao.schema.ddl.SchemaReader$1.apply(SchemaReader.java:97)
 at com.google.common.collect.Iterators$8.transform(Iterators.java:799)
 at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
 at com.google.common.collect.Iterators.addAll(Iterators.java:362)
 at com.google.common.collect.Lists.newArrayList(Lists.java:160)
 at com.google.common.collect.Lists.newArrayList(Lists.java:144)
 at net.java.ao.schema.ddl.SchemaReader.readSchema(SchemaReader.java:97)
 at net.java.ao.schema.ddl.SchemaReader.readSchema(SchemaReader.java:88)
 at net.java.ao.schema.ddl.SchemaReader.readSchema(SchemaReader.java:81)
 at net.java.ao.schema.SchemaGenerator.generateImpl(SchemaGenerator.java:107)
 at net.java.ao.schema.SchemaGenerator.migrate(SchemaGenerator.java:84)
 at net.java.ao.EntityManager.migrate(EntityManager.java:128)
 at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:51)
 at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory$1.doInTransaction(AbstractActiveObjectsFactory.java:77)
 at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory$1.doInTransaction(AbstractActiveObjectsFactory.java:72)
 at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
 at com.atlassian.sal.spring.component.SpringHostContextAccessor$1.doInTransaction(SpringHostContextAccessor.java:71)
 at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
 at com.atlassian.sal.spring.component.SpringHostContextAccessor.doInTransaction(SpringHostContextAccessor.java:68)
 at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.access$001(ConfluenceSpringHostContextAccessor.java:21)
 at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.lambda$doInTransaction$3(ConfluenceSpringHostContextAccessor.java:72)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)
 at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)
 at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.doInTransaction(ConfluenceSpringHostContextAccessor.java:72)
 at sun.reflect.GeneratedMethodAccessor238.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
 at com.sun.proxy.$Proxy314.doInTransaction(Unknown Source)
 at sun.reflect.GeneratedMethodAccessor238.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:136)
 at com.sun.proxy.$Proxy314.doInTransaction(Unknown Source)
 at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
 at sun.reflect.GeneratedMethodAccessor240.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
 at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
 at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
 at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
 at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
 at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
 at com.sun.proxy.$Proxy874.execute(Unknown Source)
 at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory.create(AbstractActiveObjectsFactory.java:72)
 at com.atlassian.activeobjects.internal.DelegatingActiveObjectsFactory.create(DelegatingActiveObjectsFactory.java:32)
 at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects$1$1$1.call(TenantAwareActiveObjects.java:91)
 ... 9 more
Caused by: java.sql.SQLSyntaxErrorException: Unknown table 'AO_9412A1_AONOTIFICATION' in information_schema
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
 at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
 at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1247)
 at com.mysql.cj.jdbc.DatabaseMetaData$7.forEach(DatabaseMetaData.java:3149)
 at com.mysql.cj.jdbc.DatabaseMetaData$7.forEach(DatabaseMetaData.java:3137)
 at com.mysql.cj.jdbc.IterateBlock.doForAll(IterateBlock.java:56)
 at com.mysql.cj.jdbc.DatabaseMetaData.getPrimaryKeys(DatabaseMetaData.java:3190)
 at com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getPrimaryKeys(NewProxyDatabaseMetaData.java:3222)
 at net.java.ao.schema.helper.DatabaseMetaDataReaderImpl.getFields(DatabaseMetaDataReaderImpl.java:127)
 ... 71 more
```

Probably I'missing something on the mysql configuration level but I followed what is described here: <https://confluence.atlassian.com/doc/database-setup-for-mysql-128747.html>

OS: ubuntu 16.04

database: mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64)

confluence version: atlassian-confluence-6.8.1-x64

Thank you.


Answers:
author: Marek Parfianowicz
body: Please check your MySQL JDBC Driver version. The ActiveObjects library has compatibility problem with the latest Connector/J **8.0.x** version of the driver. JDBC driver downgrade to **5.1.x** should help.

You can find more details here: <https://ecosystem.atlassian.net/browse/AO-3462>


author: oostendorpmuziek
body: I have the exact same problem. Anyone know a solution?

comments: author: Lucas Sapp
body: Same Issue with 5.10 and 5.11 bitbucket. It looks like the actual SQL statement is looking for a table in the information_schema database. my guess would be they want you to use Postgress.


author: Riccardo Cinti
body: After the mySQL jdbc driver downgrade everything worked fine, thanks!