Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-73132

Using velocity templates within the EmailBuilder causes an exception in a Data Center installation.

    XMLWordPrintable

Details

    Description

      Issue Summary

      Using velocity templates within the EmailBuilder causes an exception in a Data Center installation.

      Steps to Reproduce

      1. Create a Jira app using EmailBuilder loading the body or the subject from a velocity file using either the withBodyFromFile or the withSubjectFromFile

      Expected Results

      The app works correctly.

      Actual Results

      The app cannot access the velocity files anymore.

      The below exception is thrown in the atlassian-jira.log file:

      2021-12-19 10:43:08,023+0000 http-nio-8080-exec-30 ERROR admin 643x945x1 1e72xgh 172.29.198.224,10.9.32.67 /browse/FI-1 [velocity] ResourceManager : unable to find resource 'templates/mail/remindme.vm' in any resource loader.
      2021-12-19 10:43:08,023+0000 http-nio-8080-exec-30 ERROR admin 643x945x1 1e72xgh 172.29.198.224,10.9.32.67 /browse/FI-1 [c.atlassian.velocity.DefaultVelocityManager] ResourceNotFoundException occurred whilst loading resource
      2021-12-19 10:43:08,025+0000 http-nio-8080-exec-30 ERROR admin 643x945x1 1e72xgh 172.29.198.224,10.9.32.67 /browse/FI-1 [c.a.j.template.velocity.DefaultDelegatingJiraVelocityManager] Error while using JiraHomeVelocityManager. Will fallback to classpath JiraVelocityManager
      org.apache.velocity.exception.VelocityException: Could not find template 'templates/mail/remindme.vm' ensure it is in the classpath.
      	at com.atlassian.velocity.DefaultVelocityManager.exceptionHandling(DefaultVelocityManager.java:140)
      	at com.atlassian.velocity.DefaultVelocityManager.writeEncodedBodyImpl(DefaultVelocityManager.java:123)
      	at com.atlassian.velocity.DefaultVelocityManager.writeEncodedBody(DefaultVelocityManager.java:97)
      	at com.atlassian.jira.template.velocity.DefaultDelegatingJiraVelocityManager.writeEncodedBody(DefaultDelegatingJiraVelocityManager.java:136)
      	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.renderEmailSubject(EmailRenderer.java:99)
      	at com.atlassian.jira.mail.builder.EmailRenderer.render(EmailRenderer.java:166)
      	at com.atlassian.jira.mail.builder.EmailBuilder.renderNow(EmailBuilder.java:155)
      	at com.atlassian.jira.mail.builder.EmailBuilder.renderNowAsQueueItem(EmailBuilder.java:145)
      	at com.example.plugins.tutorial.jira.workflow.ParentIssueBlockingCondition.passesCondition(ParentIssueBlockingCondition.java:49)
      

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ccurti Caterina (or Kate) Curti
              Votes:
              8 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: