Confluence Space XML export fails with 'java.lang.IllegalArgumentException'
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Problem
The Confluence Space XML export (See: Export Content to Word, PDF, HTML and XML) fails with the following error.
java.lang.IllegalArgumentException: Table or field name is not allowed: dbo.CONTENTPROPERTIES
Symptoms
A detailed exception is reported in the atlassian-confluence.log:
2024-05-21 13:50:34,153 WARN [ConfluenceBackupRestoreManager:thread-4] [confluence.impl.backuprestore.ConfluenceBackupRestoreManager] updateJobStateAfterCompletion Backup restore job BackupRestoreJob{id=425984002, jobOperation=BACKUP, jobScope=SPACE, jobState=PROCESSING, createTime=2024-05-21T11:50:34Z, startProcessingTime=2024-05-21T11:50:34Z, finishProcessingTime=null, cancelTime=null, owner='userkfnu', whoCancelledTheJob='null', errorMessage='null'} failed: java.lang.IllegalArgumentException: Table or field name is not allowed: dbo.CONTENTPROPERTIES -- url: /rest/api/backup-restore/backup/space | userName: userkfnu | referer: https://domain.xx/plugins/servlet/space-tool-backup/~userkfnu | traceId: 702d2dcb941ea29acom.atlassian.confluence.backuprestore.exception.BackupRestoreException: java.lang.Illega¯lArgumentException: Table or field name is not allowed: dbo.CONTENTPROPERTIES at com.atlassian.confluence.impl.backuprestore.backup.SpaceBackupService.doBackupSynchronously(SpaceBackupService.java:123) at com.atlassian.confluence.impl.backuprestore.BackupRestoreJobRunner.runJobSynchronously(BackupRestoreJobRunner.java:58)
at com.atlassian.confluence.impl.backuprestore.ConfluenceBackupRestoreManager.runJobAndUpdateJobProperties(ConfluenceBackupRestoreManager.java:271)
at com.atlassian.confluence.impl.backuprestore.ConfluenceBackupRestoreManager.processJobsFromTheQueue(ConfluenceBackupRestoreManager.java:250)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)Caused by: java.lang.IllegalArgumentException: Table or field name is not allowed: dbo.CONTENTPROPERTIES
at com.atlassian.confluence.impl.backuprestore.backup.exporters.DatabaseExporterHelper.checkNameDoesNotHaveSqlInjections(DatabaseExporterHelper.java:250)
at com.atlassian.confluence.impl.backuprestore.backup.exporters.ContentPropertyDataExporter.buildQuery(ContentPropertyDataExporter.java:47)
at com.atlassian.confluence.impl.backuprestore.backup.exporters.ContentPropertyDataExporter.<init>(ContentPropertyDataExporter.java:43)
at com.atlassian.confluence.impl.backuprestore.backup.exporters.ExporterFactory.createContentPropertySpaceExporter(ExporterFactory.java:86)
at com.atlassian.confluence.impl.backuprestore.backup.exporters.SpaceExportersFactory.createContentPropertyExporter(SpaceExportersFactory.java:105)
at com.atlassian.confluence.impl.backuprestore.backup.exporters.SpaceExportersFactory.createExporters(SpaceExportersFactory.java:52)
at com.atlassian.confluence.impl.backuprestore.backup.SpaceBackupService.backupAllEntitiesAndAttachments(SpaceBackupService.java:155)
at com.atlassian.confluence.impl.backuprestore.backup.AbstractBackupService.performBackup(AbstractBackupService.java:76)
at com.atlassian.confluence.impl.backuprestore.backup.SpaceBackupService.doBackupSynchronously(SpaceBackupService.java:106) {code}
Cause
The presence of the property hibernate.default_schema in the confluence.cfg.xml file (See: Confluence Home and other important directories) can cause this error.
The hibernate.default_schema property (<property name="hibernate.default_schema">[confluence_schema]</property>) specifies the default schema for databases, mostly Oracle and MS SQL Server databases within confluence.cfg.xml. This means that if a database object (like a table) is referenced without a schema, Hibernate will use the one defined by hibernate.default_schema.
However, in Confluence, we already set DEFAULT_SCHEMA (See: Database Setup for SQL Server) for the Confluence user at the database level and the additional property of hibernate.default_schema can cause issues with SQL injection rules.
Resolution
- Stop the Application.
Remove below property from confluence.cfg.xml:
<property name="hibernate.default_schema">[confluence_schema]</property>
Start the application.
Rerun the Space XML export.