System error while loading pages with attachments in Confluence 5.4.x or earlier versions
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
Summary
Navigating to a page that has attachments triggers a "System Error" in the UI:

The following error appears on the page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Cause
java.lang.RuntimeException: Error rendering template for decorator root
at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191)
caused by: java.lang.RuntimeException: Error rendering template for decorator page
at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191)
caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDisplayableLabel' in class com.atlassian.confluence.plugin.descriptor.web.model.ConfluenceWebLabel threw exception com.atlassian.core.exception.InfrastructureException: Error occurred rendering template content at template/includes/menu-macros.vm[line 281, column 36]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
caused by: com.atlassian.core.exception.InfrastructureException: Error occurred rendering template content
at com.atlassian.confluence.util.velocity.VelocityUtils.writeRenderedContent(VelocityUtils.java:187)
caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLatestVersionsOfAttachments' in class com.atlassian.confluence.pages.Page$$EnhancerByCGLIB$$b6314f3d threw exception net.sf.hibernate.LazyInitializationException: cannot access loading collection at getRenderedContent[line 1, column 15]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
caused by: net.sf.hibernate.LazyInitializationException: cannot access loading collection
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:191)
Stack Trace:[hide]
java.lang.RuntimeException: Error rendering template for decorator root
at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
....
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLatestVersionsOfAttachments' in class com.atlassian.confluence.pages.Page$$EnhancerByCGLIB$$b6314f3d threw exception net.sf.hibernate.LazyInitializationException: cannot access loading collection at getRenderedContent[line 1, column 15]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1277)
at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1216)
at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1165)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:219)
at com.atlassian.confluence.util.velocity.VelocityUtils.writeRenderedContent(VelocityUtils.java:179)
... 483 more
Caused by: net.sf.hibernate.LazyInitializationException: cannot access loading collection
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:191)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Bag.iterator(Bag.java:256)
at com.atlassian.confluence.core.ContentEntityObject.getLatestVersionsOfAttachments(ContentEntityObject.java:614)
at com.atlassian.confluence.core.ContentEntityObject$$FastClassByCGLIB$$96df24d5.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:108)
at com.atlassian.confluence.pages.Page$$EnhancerByCGLIB$$b6314f3d.getLatestVersionsOfAttachments(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at com.atlassian.confluence.velocity.introspection.UnboxingMethod.invoke(UnboxingMethod.java:34)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
... 491 more
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
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:
1
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.
Solution
Resolution
Backup your database
Modify the records in the
attachments
table that returns aNULL
:1 2 3
UPDATE ATTACHMENTS SET MINOR_EDIT = '' WHERE MINOR_EDIT IS NULL;
Flush the Confluence caches atCache Management > Click on Show advanced view > Scroll all the way down and click on Flush all
Rebuild the index through the UI, attheContent Indexing page
Navigate to the problematic page(s)
Was this helpful?