Grails渲染插件与grails 3.1.1

时间:2017-05-29 10:37:20

标签: grails grails-plugin

我正尝试使用this plugin

将gsp转换为pdf

i also read this question

但我仍然会遇到一些错误

java.lang.NullPointerException: null
    at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1337) ~[na:1.8.0_131]
    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1197) ~[na:1.8.0_131]
    at java.beans.Introspector.getBeanInfo(Introspector.java:426) ~[na:1.8.0_131]
    at java.beans.Introspector.getBeanInfo(Introspector.java:173) ~[na:1.8.0_131]
    at grails.plugins.rendering.document.RenderEnvironment.init(RenderEnvironment.groovy:31) ~[rendering-2.0.3.jar:na]
    at grails.plugins.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:68) ~[rendering-2.0.3.jar:na]
    at grails.plugins.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:60) ~[rendering-2.0.3.jar:na]
    at grails.plugins.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:65) ~[rendering-2.0.3.jar:na]
    at grails.plugins.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:35) ~[rendering-2.0.3.jar:na]

这是我的代码。

 def createPdfReport = {
    def cif = corporateUserService.getCurrentCifUser().cif
    def perintahkerjaIns = PerintahKerja.findByCifAndId(cif,params.id)
    def perintahkerjaDets = PerintahKerjaDetail.findAllByPerintahKerja(perintahkerjaIns,[sort:"pohon",order:"asc"])
    def perintahpekerja = PerintahPekerja.findAllByPerintahKerja(perintahkerjaIns)

    renderPdf(template: '/perintahKerja/templatprintperintahkerja',model: [jumlahpohon: perintahkerjaDets.size(), cif: cif, perintahLerjaInstance:perintahkerjaIns, perintahKerjaDetails:perintahkerjaDets, perintahPekerjaList: perintahpekerja], filename: "PerintahKerja")
}

我不知道我错过了什么。

2 个答案:

答案 0 :(得分:0)

你确定该插件适用于grails 3吗?自从我阅读插件github以来,它说构建失败了,并且自2年前开始就有一个看起来非常像你所拥有的问题的开放票,但直到现在还没有解决。 github的最后一次提交也是大约2年前。 打开的票据是使用grails 2,所以我认为,该插件不适用于grails 3(因为它可能没有更新为grails 3插件)

答案 1 :(得分:0)

将以下依赖项添加到build.gradle:

dependencies {
    ...
    runtime "org.springframework:spring-test:4.2.1.RELEASE"
}

我最近为其他用户提供了一些与渲染插件相关的问题,因此可能会使用thisthis