Space Backup fails due to java.lang.ClassCastException
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
The Space XML backup fails and results in a java.lang.ClassCastException error.
環境
Confluence Data Center
診断
The application log, atlassian-confluence.log, will display WARN messages indicating the following exception: java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer.
2024-04-10 02:54:37,669 WARN [ConfluenceBackupRestoreManager:thread-24] [confluence.impl.backuprestore.ConfluenceBackupRestoreManager] updateJobStateAfterCompletion Backup restore job BackupRestoreJob{id=1008762890, jobOperation=BACKUP, jobScope=SPACE, jobState=PROCESSING, createTime=2024-04-10T07:54:36Z, startProcessingTime=2024-04-10T07:54:36Z, finishProcessingTime=null, cancelTime=null, owner='abcd', whoCancelledTheJob='null', errorMessage='null'} failed: java.util.concurrent.ExecutionException: java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap')
-- url: /docs/rest/api/backup-restore/backup/space | userName: abcd | referer: https://abc.xyz.com/docs/plugins/xxxx/xxx | traceId: e45daeca248a11dd
Check the data types for the columns in the `content` and `contentproperties` tables. The columns `child_position`, `draftpageversion`, and `version` should all be of the integer data type.
原因
The issue can be due to a change in the data type of the columns in the content and contentproperties tables; however, the reason for the change was unclear in this scenario.
ソリューション
To resolve this issue, follow these steps to change the data type of the columns to integer for the content and contentproperties tables:
- Confluence をシャットダウンします。
- Take full backup of Confluence DB.
Execute below SQL command to alter the datatype.
Postgres のクエリ
alter table content alter column child_position type integer, alter column version type integer, alter column draftpageversion type integer;MySQL クエリ
ALTER TABLE CONTENT MODIFY COLUMN hibernateversion integer, MODIFY COLUMN child_position integer, MODIFY COLUMN version integer, MODIFY COLUMN draftpageversion integer;SQL Server のクエリ
ALTER TABLE CONTENT ALTER COLUMN CHILD_POSITION INT; ALTER TABLE CONTENT ALTER COLUMN VERSION INT; ALTER TABLE CONTENT ALTER COLUMN DRAFTPAGEVERSION INT;Note : Only alter those columns which are NOT having integer data type.
Confluence を起動します。
- Verify the Space XML backup