Jira notification emails are not showing field changes or are showing error message after an upgrade
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
After the Jira application was upgraded (usually to 8.13.x or higher), the Jira notifications emails sent when issue fields are updated contain invalid/broken formatting
either the notification email is missing the old and new value of the fields that were updated
or the notification email will show an error similar to the ones shown below:
Example 1
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- org.apache.velocity.exception.MethodInvocationException: Invocation of method 'diff' in class com.atlassian.jira.mail.DiffUtils threw exception java.lang.NullPointerException at templates/email/html/includes/changelog-issue-description.vm[line 10, column 39] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:342) 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.value(ASTReference.java:507) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1276) at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1215) at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1164) at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:219) at com.atlassian.velocity.DefaultVelocityManager.writeEncodedBodyForContent(DefaultVelocityManager.java:86) at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest.toWriterImpl(DefaultVelocityTemplatingEngine.java:129) at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest.asPlainText(DefaultVelocityTemplatingEngine.java:108) at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest$1.with(DefaultVelocityTemplatingEngine.java:92) at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest$StringRepresentation.toString(DefaultVelocityTemplatingEngine.java:77) at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest.asPlainText(DefaultVelocityTemplatingEngine.java:94) at com.atlassian.jira.mail.builder.EmailRenderer.renderEmailBody(EmailRenderer.java:103) at com.atlassian.jira.mail.builder.EmailRenderer.render(EmailRenderer.java:150) at com.atlassian.jira.mail.builder.EmailBuilder.renderNow(EmailBuilder.java:155) at com.atlassian.jira.mail.builder.EmailBuilder.renderNowAsQueueItem(EmailBuilder.java:145) at com.atlassian.jira.mail.MailingListCompiler$1.evaluateEmailForRecipient(MailingListCompiler.java:336) at com.atlassian.jira.mail.NotificationRecipientProcessor.evaluateEmails(NotificationRecipientProcessor.java:39) at com.atlassian.jira.mail.MailingListCompiler.evaluateEmails(MailingListCompiler.java:267) at com.atlassian.jira.mail.MailingListCompiler.access$300(MailingListCompiler.java:49) at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.lambda$addEmailsToQueue$0(MailingListCompiler.java:466) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1699) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.addEmailsToQueue(MailingListCompiler.java:468) at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.sendLists(MailingListCompiler.java:438) at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.sendNoLevelsIgnoreGroup(MailingListCompiler.java:414) at com.atlassian.jira.mail.MailingListCompiler$NotificationCompiler.evaluateForAll(MailingListCompiler.java:410) at com.atlassian.jira.mail.MailingListCompiler.prepareEmail(MailingListCompiler.java:170) at com.atlassian.jira.mail.MailingListCompiler.sendLists(MailingListCompiler.java:101) at com.atlassian.jira.mail.IssueMailQueueItem.send(IssueMailQueueItem.java:128) at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:83) at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:47) at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:51) at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:48) at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110) at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:56) at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:48) at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21) at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:68) at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62) at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44) at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32) at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134) at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106) at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:402) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:380) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at java.util.regex.Matcher.getTextLength(Matcher.java:1283) at java.util.regex.Matcher.reset(Matcher.java:309) at java.util.regex.Matcher.<init>(Matcher.java:229) at java.util.regex.Pattern.matcher(Pattern.java:1093) at com.atlassian.diff.WordLevelDiffer.tokenize(WordLevelDiffer.java:161) at com.atlassian.diff.WordLevelDiffer.diffLine(WordLevelDiffer.java:89) at com.atlassian.diff.DiffViewBean.createWordLevelDiff(DiffViewBean.java:108) at com.atlassian.jira.mail.DiffUtils.diff(DiffUtils.java:19) at sun.reflect.GeneratedMethodAccessor15181.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:385) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:374) at com.atlassian.velocity.htmlsafe.introspection.UnboxingMethod.invoke(UnboxingMethod.java:28) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270) ... 65 more
Example 2
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- org.apache.velocity.exception.MethodInvocationException: Invocation of method 'formatUsername' in class com.atlassian.jira.plugin.userformat.DefaultUserFormatManager threw exception com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException: Cannot invoke "com.atlassian.jira.template.soy.SoyTemplateRendererProvider.getRenderer()" because the return value of "com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType(java.lang.Class)" is null, at templates/email/macros.vm[line 15, column 21], at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:342), 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.ASTBlock.render(ASTBlock.java:72), at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87), at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72), at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212), at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247), at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175), at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336), at org.apache.velocity.runtime.parser.node.ASTStringLiteral.value(ASTStringLiteral.java:290), at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71), at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142), at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72), at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336), at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106), at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72), at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212), at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247), at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175), at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336), at org.apache.velocity.Template.merge(Template.java:328), at org.apache.velocity.Template.merge(Template.java:235), at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381), at com.atlassian.velocity.DefaultVelocityManager.writeEncodedBodyImpl(DefaultVelocityManager.java:98), at com.atlassian.velocity.DefaultVelocityManager.writeEncodedBody(DefaultVelocityManager.java:84), at com.atlassian.jira.template.velocity.DefaultDelegatingJiraVelocityManager.writeEncodedBody(DefaultDelegatingJiraVelocityManager.java:137), at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest.toWriterImpl(DefaultVelocityTemplatingEngine.java:122), at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest.asPlainText(DefaultVelocityTemplatingEngine.java:108), at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest$1.with(DefaultVelocityTemplatingEngine.java:92), at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest$StringRepresentation.toString(DefaultVelocityTemplatingEngine.java:77), at com.atlassian.jira.template.velocity.DefaultVelocityTemplatingEngine$DefaultRenderRequest.asPlainText(DefaultVelocityTemplatingEngine.java:94), at com.atlassian.jira.mail.builder.EmailRenderer.renderPlainTextBody(EmailRenderer.java:137), at com.atlassian.jira.mail.builder.EmailRenderer.renderHtmlBody(EmailRenderer.java:142), at com.atlassian.jira.mail.builder.EmailRenderer.renderEmailBody(EmailRenderer.java:121), at com.atlassian.jira.mail.builder.EmailRenderer.render(EmailRenderer.java:170), at com.atlassian.jira.mail.builder.RenderingMailQueueItem.send(RenderingMailQueueItem.java:29), at com.atlassian.jira.mail.CountingMailQueueItemWrapper.send(CountingMailQueueItemWrapper.java:26), at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:83), at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:47), at com.atlassian.jira.mail.JiraMailQueue.lambda$sendAndUpdateIpdMetric$0(JiraMailQueue.java:154), at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110), at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:56), at com.atlassian.jira.mail.JiraMailQueue.sendAndUpdateIpdMetric(JiraMailQueue.java:153), at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:70), at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21), at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:68), at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62), at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44), at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32), at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134), at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106), at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90), at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:500), at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJobWithRetryOnFailure(CaesiumSchedulerService.java:463), at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:413), at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66), at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60), at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35), at java.base/java.lang.Thread.run(Unknown Source) Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException: Cannot invoke "com.atlassian.jira.template.soy.SoyTemplateRendererProvider.getRenderer()" because the return value of "com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType(java.lang.Class)" is null, at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2086), at com.google.common.cache.LocalCache.get(LocalCache.java:4012), at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4920), at com.atlassian.jira.plugin.userformat.CachingUserFormat.formattedUserProfileFromCacheIfAny(CachingUserFormat.java:69), at com.atlassian.jira.plugin.userformat.CachingUserFormat.format(CachingUserFormat.java:62), at com.atlassian.jira.plugin.userformat.UserFormatterImpl.formatUsername(UserFormatterImpl.java:44), at com.atlassian.jira.plugin.userformat.DefaultUserFormatManager.formatUsername(DefaultUserFormatManager.java:60), at jdk.internal.reflect.GeneratedMethodAccessor30775.invoke(Unknown Source), at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source), at java.base/java.lang.reflect.Method.invoke(Unknown Source), at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:385), at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:374), at com.atlassian.velocity.htmlsafe.introspection.UnboxingMethod.invoke(UnboxingMethod.java:28), at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270) ... 59 more Caused by: java.lang.NullPointerException: Cannot invoke "com.atlassian.jira.template.soy.SoyTemplateRendererProvider.getRenderer()" because the return value of "com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType(java.lang.Class)" is null, at com.atlassian.jira.plugin.userformat.ProfileLinkUserFormat.getSoyRenderer(ProfileLinkUserFormat.java:113), at com.atlassian.jira.plugin.userformat.ProfileLinkUserFormat.getInitialParams(ProfileLinkUserFormat.java:108), at com.atlassian.jira.plugin.userformat.ProfileLinkUserFormat.format(ProfileLinkUserFormat.java:67), at com.atlassian.jira.plugin.userformat.CachingUserFormat$1.call(CachingUserFormat.java:85), at com.atlassian.jira.plugin.userformat.CachingUserFormat$1.call(CachingUserFormat.java:82), at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4925), at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3571), at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2313), at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2190), at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2080) ... 72 more
Environment
Jira Data Center 8.13.x
Diagnosis
The issue only occurs when Batched Notifications are disabled in ⚙ > System > Batching email notifications
The issue usually occurs after an upgrade to Jira 8.13.0 or higher
The velocity templates for the non-batched notifications were manually modified (Jira is not using the templates that ship out-of-the-box), which can be verified in the Jira application logs, right after a Jira re-start:
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
___ Modifications ___________________________ Modified Files : templates/email/subject/issueresolved.vm, templates/email/subject/issuecreated.vm, templates/email/subject/issuereopened.vm, templates/email/subject/issueclosed.vm, templates/email/html/includes/fields/worklogchanges.vm, templates/email/subject/issueworkstopped.vm, templates/email/html/issuecommentedited.vm, templates/jira/issue/field/issuetype-columnview.vm, templates/email/html/includes/changelog-issue-description.vm, templates/email/subject/issuegenericevent.vm, templates/email/subject/issuearchived.vm, templates/email/subject/issueassigned.vm, templates/email/subject/issueworkstarted.vm, templates/email/subject/issuedeleted.vm, templates/email/html/includes/set-issue-details-context.vm, templates/email/html/includes/patterns/worklog-top.vm, templates/email/subject/issueworklogdeleted.vm, templates/email/subject/issuecommentedited.vm, templates/email/subject/issueworklogupdated.vm, templates/email/subject/issueupdated.vm, templates/email/subject/issueworklogged.vm, templates/email/subject/issuerestored.vm, templates/email/subject/issuecommented.vm, templates/email/html/includes/fields/changelog.vm, templates/email/subject/issuemoved.vm Removed Files : None
The 3rd party add-on JEditor - Rich Text Editor for Jira might be installed in the Jira application:
1 2 3 4 5 6 7 8 9 10
<plugin> <key>com.jiraeditor.jeditor</key> <name>JEditor</name> <version>3.9.10.1</version> <vendor>Bobronix</vendor> <status>ENABLED</status> <vendor-url>https://bobronix.com</vendor-url> <framework-version>2</framework-version> <bundled>User installed</bundled> </plugin>
Cause
The velocity templates used by the Jira non-batched notifications have been manually customized (or some of these templates are coming from the 3rd party add-on JEditor), and the customization is no longer working in Jira 8.13.0.
Any customization of these velocity templates falls outside of Jira Support Offerings, therefore Atlassian cannot guarantee that these customizations will work in any Jira version.
Solution
Revert all the velocity templates to the original ones that ship with Jira out-of-the-box:
Go to the Jira Server download page and download the zip file from the Jira version that your Jira application was last upgraded to
Unzip the Jira installer
Go to the Jira installation directory and backup the entire folder <JIRA_INSTALL_DIRECTORY>/atlassian-jira/WEB-INF/classes/templates/email/
Stop the Jira application
Replace this folder with the fresh folder that ships with the unzipped Jira installer
Start the Jira application
Repeat these steps for each Jira node, in case Jira is using Data Center with multiple nodes
Trigger a few Jira notifications by editing some fields in Jira issues, and verify that the notifications now have the correct content
Was this helpful?