After upgrading Confluence shows "Error occurred during template rendering. Contact your administrator for assistance" error
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
When trying to reach out to Confluence, the "Error occurred during template rendering. Contact your administrator for assistance." is displayed in the browser:
Environment
Confluence 8.1.x and later
Diagnosis
The following ERROR appears in the <confluence-home>/atlassian-confluence.log
:
2023-08-21 14:56:46,139 ERROR [http-nio-27196-exec-7] [confluence.util.profiling.ConfluenceSitemeshDecorator] renderToResponse Error occurred rendering template: /decorators/login.vmd
-- url: /c7196/login.action | userName: anonymous | traceId: 41cf7fa8202f282a
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'isUsesCustomLogo' in class com.atlassian.confluence.plugins.lookandfeel.SiteLogoVelocityHelper threw exception com.atlassian.cache.CacheException: org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at /decorators/includes/common-header.vm[line 23, column 22]
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:228)
[...]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.atlassian.cache.CacheException: org.hibernate.NonUniqueResultException: query did not return a unique result: 2
at com.atlassian.cache.ehcache.DelegatingCachedReference.get(DelegatingCachedReference.java:75)
at com.atlassian.cache.impl.metrics.InstrumentedCachedReference.get(InstrumentedCachedReference.java:58)
at com.atlassian.confluence.plugins.lookandfeel.AttachmentSiteLogoManager.useCustomLogo(AttachmentSiteLogoManager.java:122)
at com.atlassian.confluence.plugins.lookandfeel.SiteLogoVelocityHelper.isUsesCustomLogo(SiteLogoVelocityHelper.java:18)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142)
at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:529)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)
... 280 more
Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 2
at com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.uniqueResult(HibernateObjectDao.java:587)
at com.atlassian.confluence.setup.settings.DefaultGlobalDescriptionDao.getGlobalDescription(DefaultGlobalDescriptionDao.java:20)
at com.atlassian.confluence.impl.settings.DefaultGlobalDescriptionManager.getGlobalDescription(DefaultGlobalDescriptionManager.java:92)
at com.atlassian.confluence.impl.settings.DelegatingLegacySettingsManager.getGlobalDescription(DelegatingLegacySettingsManager.java:67)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[...]
at com.sun.proxy.$Proxy1369.getGlobalDescription(Unknown Source)
at com.atlassian.confluence.plugins.lookandfeel.AttachmentSiteLogoManager.attachmentTargetEntity(AttachmentSiteLogoManager.java:169)
at com.atlassian.confluence.plugins.lookandfeel.AttachmentSiteLogoManager.customLogoAttachment(AttachmentSiteLogoManager.java:126)
at com.atlassian.confluence.plugins.lookandfeel.AttachmentSiteLogoManager.lambda$new$0(AttachmentSiteLogoManager.java:80)
[...]
Cause
Based on the Java methods that can be seen in the stacktrace (com.atlassian.confluence.setup.settings.DefaultGlobalDescriptionDao.getGlobalDescription
), there are multiple records for 'GLOBALDESCRIPTION
' in the CONTENT
the table where Confluence expected a unique result.
Solution
Execute the below SQL query to get all the records related to the '
GLOBALDESCRIPTION
':select * from content where contenttype = 'GLOBALDESCRIPTION';
If we are affected by the described issue, we should see more than one record like below:
CONTENTID CONTENTTYPE TITLE VERSION CREATOR CREATIONDATE LASTMODIFIER LASTMODDATE VERSIONCOMMENT PREVVER CONTENT_STATUS ... HIBERNATEVERSION LOWERTITLE 131074 GLOBALDESCRIPTION Confluence 1 19.08.2022 06:19:02 19.08.2022 06:19:02 current ... 0 confluence 1 GLOBALDESCRIPTION 1 10.12.2022 11:40:13 10.12.2022 11:40:13 current ... 0 We need to delete one of the records. Based on the values in
CONTENTID
column, in the above example, the latter one(CONTENTID=1), looks more 'suspicious' as we know that ID is generated randomly, and it does not look like an ID that we generally see.
Note: The records can appear indistinct(literally the same contents). In this case attempting to delete one of the records will either result in a deleted row, or will return a foreign key constraint error; if a record is not deleted, a foreign key constraint violation returned, purge the other. Our ultimate goal is to remove the extraneousGLOBALDESCRIPTION
. This has not resulted in reports of loss of data.Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
- Stop Confluence.
- Backup Confluence database and filesystem.
Execute the below SQL query to delete the redundant '
GLOBALDESCRIPTION
':delete from content where contentid = 1;
- Restart Confluence