Space Backup fails due to java.lang.ClassCastException

Still need help?

The Atlassian Community is here for you.

Ask the community


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

Summary

The Space XML backup fails and results in a java.lang.ClassCastException error.

Environment

Confluence Data Center

Diagnosis

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.

Cause

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.

Solution

To resolve this issue, follow these steps to change the data type of the columns to integer for the content and contentproperties tables:

  1. Shutdown Confluence
  2. Take full backup of Confluence DB.
  3. Execute below SQL command to alter the datatype. 

    alter table content 
    alter column child_position type integer,
    alter column version type integer,
    alter column draftpageversion type integer;
    ALTER TABLE CONTENT 
      MODIFY COLUMN hibernateversion integer,
      MODIFY COLUMN child_position integer,
      MODIFY COLUMN version integer,
      MODIFY COLUMN draftpageversion integer;
    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.

  4. Start Confluence 

  5. Verify the Space XML backup


Last modified on Oct 14, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.