System error while loading pages with attachments in Confluence 5.4.x or earlier versions
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
Navigating to a page that has attachments triggers a "System Error" in the UI:
The following error appears on the page:
Environment
Confluence server and Datacenter 5.4.x or earlier versions
Diagnosis
Search the <confluence-home>/logs/atlassian-confluence.log file for the error message in the UI. In the stack trace, we may find the following Caused By:
Caused by: net.sf.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.atlassian.confluence.pages.Attachment.minorEdit
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:57)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:229)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2239)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:319)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:309)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:1020)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:995)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:288)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3330)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
If we find the aforementioned error, run the following query, if it returns any records, you're affected by the issue reported in this KB:
SELECT * FROM ATTACHMENTS WHERE MINOR_EDIT IS NULL;
This KB doesn't apply to Confluence 5.5.x or later versions – Confluence 5.4.x or earlier versions had the option to store attachments in the database, this was configurable during Confluence installation. The Attachments table was created for this and was deprecated in Confluence 5.5.x. We no longer offer the option to store the attachments in the database in this version and newer.
Exception: If the attachments table still exists in Confluence 5.5.x or later versions, the recommended attachment migration from the database to the file system wasn't executed so we need to perform the migration.
Cause
The root cause is unknown, however, there's a problem with attachment metadata and what Confluence expects. Specifically, there are records in the attachments
table that has a NULL
value in the MINOR_EDIT
column. Even though NULL
values are allowed, Confluence doesn't expect to find them and throws an error.
Resolution
- Backup your database
Modify the records in the
attachments
table that returns aNULL
:UPDATE ATTACHMENTS SET MINOR_EDIT = '' WHERE MINOR_EDIT IS NULL;
- Flush the Confluence caches at Cache Management > Click on Show advanced view > Scroll all the way down and click on Flush all
- Rebuild the index through the UI, at the Content Indexing page
- Navigate to the problematic page(s)