【问题标题】:Grails 3.3: Rending Plugin 2.0.3: UnknownTemplateException Could not find template for 'template' on productionGrails 3.3:渲染插件 2.0.3:UnknownTemplateException 在生产中找不到“模板”的模板
【发布时间】:2019-03-02 07:24:46
【问题描述】:

我正在尝试使用grails rending plugin 在 Grails 中生成 PDF。

运行gradle bootRun时以下将起作用

class DocumentService {

   def generatePdf() {

     // ...

       ByteArrayOutputStream stream = pdfRenderingService.render(
            template    : 'template_name',
            model       : [ name : 'taylor' ],
            controller  : 'controllerName'
       )

   }
}

但是,当部署在 tomcat8 上时。

 grails.plugins.rendering.document.UnknownTemplateException: Could not find template for 'template_name'
at grails.plugins.rendering.document.XhtmlDocumentService.createTemplate(XhtmlDocumentService.groovy:102)
at grails.plugins.rendering.document.XhtmlDocumentService$_generateXhtml_closure1.doCall(XhtmlDocumentService.groovy:66)
at grails.plugins.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:70)
at grails.plugins.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:60)
at grails.plugins.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:65)
at grails.plugins.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:35)
at grails.plugins.rendering.RenderingService.render(RenderingService.groovy:36)
at grails.plugins.rendering.RenderingService.render(RenderingService.groovy:35)

【问题讨论】:

标签: grails groovy tomcat8 gsp


【解决方案1】:

如果您使用 gsp 作为模板文件。 您需要在 build.gradle 中包含:grails-gsp 插件

应用插件:“org.grails.grails-gsp”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-30
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    • 1970-01-01
    • 2012-07-18
    • 2012-01-11
    • 2015-01-18
    相关资源
    最近更新 更多