Bamboo Export process fails with error "Could not read fields for table AO_013613_ACTIVITY_SOURCE"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Export of data for backup from Bamboo Overview > System > Export tab fails with the below error shown on Bamboo UI:
Export has failed. Errors encountered while exporting: Could not read fields for table AO_013613_ACTIVITY_SOURCE.
Environment
All supported versions of Bamboo and this case were seen with the MySQL database server
Diagnosis
Enable debugging in Bamboo for classpath: com.atlassian.bamboo.migration.stream.activeobjects
Bamboo server logs <Bamboo-Home>/logs/atlassian-bamboo.log show something like below debug logs:
2023-04-20 13:23:12,282 INFO [http-nio-8085-exec-20] [XmlMigrator] Writing xml to file: /var/atlassian/bamboo_home/shared/exports/export_expressprintbamboo_80110_20230420.zip/db-export/activeObjects.xml 2023-04-20 13:23:12,282 DEBUG [http-nio-8085-exec-20] [ActiveObjectsBackupProgressMonitor] ActiveObjects backup: begin 2023-04-20 13:23:12,283 DEBUG [http-nio-8085-exec-20] [ActiveObjectsBackupProgressMonitor] ActiveObjects backup: begin database information backup 2023-04-20 13:23:12,283 DEBUG [http-nio-8085-exec-20] [ActiveObjectsBackupProgressMonitor] ActiveObjects backup: end database information backup 2023-04-20 13:23:12,283 DEBUG [http-nio-8085-exec-20] [ActiveObjectsBackupProgressMonitor] ActiveObjects backup: begin table definitions backup 2023-04-20 13:23:13,446 ERROR [http-nio-8085-exec-20] [XmlMigrator] Problems occurred while exporting java.lang.RuntimeException: Could not read fields for table AO_013613_ACTIVITY_SOURCE at net.java.ao.schema.helper.DatabaseMetaDataReaderImpl.getFields(DatabaseMetaDataReaderImpl.java:136) 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$6.transform(Iterators.java:826) at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52) at com.google.common.collect.Iterators.addAll(Iterators.java:367) at com.google.common.collect.Lists.newArrayList(Lists.java:147) at com.google.common.collect.Lists.newArrayList(Lists.java:133) at net.java.ao.schema.ddl.SchemaReader.readSchema(SchemaReader.java:97) at com.atlassian.activeobjects.backup.ActiveObjectsTableReader.read(ActiveObjectsTableReader.java:50) at com.atlassian.dbexporter.exporter.TableDefinitionExporter.export(TableDefinitionExporter.java:35) ........ com.atlassian.bamboo.plugin.osgi.InvocationHandlers$ClassLoaderSwitchingInvocationHandler.invokeServiceMethod(InvocationHandlers.java:71) at com.atlassian.bamboo.plugin.osgi.InvocationHandlers$DynamicServiceInvocationHandler.invoke(InvocationHandlers.java:45) at com.sun.proxy.$Proxy1893.save(Unknown Source) .......... com.atlassian.bamboo.filter.ClickjackingAndMimeTypeSniffingPreventionFilter.doFilter(ClickjackingAndMimeTypeSniffingPreventionFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ....... Caused by: java.sql.SQLSyntaxErrorException: Table 'bamboo_old.AO_013613_ACTIVITY_SOURCE' doesn't exist at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1009) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java) at net.java.ao.schema.helper.DatabaseMetaDataReaderImpl.getResultSetMetaData(DatabaseMetaDataReaderImpl.java:266) at net.java.ao.schema.helper.DatabaseMetaDataReaderImpl.getFields(DatabaseMetaDataReaderImpl.java:86) ... 330 more
Export fails while taking the backup of ActiveObjects table(Start with AO_%) definitions from the database:
2023-04-20 13:23:12,283 DEBUG [http-nio-8085-exec-20] [ActiveObjectsBackupProgressMonitor] ActiveObjects backup: begin table definitions backup
Check the AO tables list with the below SQL query on Bamboo database server(the below sample is given for MySQL DB) to see if any other table schemas are available for the AO tables:
select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME like 'AO%';
Cause
Having other db schemas or other databases on the database server where Bamboo database is running cause the issue. For this case, there are 2 other db schemas jiratest, and bamboo8 available on the MySQL server used for the Bamboo instance along with the bamboo_old schema which is the actual schema for the Bamboo DB.
Solution
It is recommended not to use multiple databases on the DB server used for Bamboo application. We suggest deleting the other databases available on the Bamboo DB server and keeping only the Bamboo DB.
If any other db schemas are available on the Bamboo DB server, keep the Bamboo DB schema used for your Bamboo instance(which is having the export issue) only as a default schema to be used by your DB server so that Bamboo will consider only this schema while performing the export and will not consider the other schemas available on DB server.