简体   繁体   中英

Grails rendering plugin with grails 3.1.1

i am trying to convert from gsp to pdf with this plugin

and i also read this question

but i still get some error like this

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]

this is my code.

 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")
}

i don't know what i missed.

Are you sure that the plugin works with grails 3? Since i read the plugin github, it says that the build is failing and there is an open ticket since 2 years ago regarding the problem that looks very much like what you have, but until now it hasn't been resolved yet. Last commit at github is also about 2 years ago. The open ticket is using grails 2, so i think, the plugin won't work for grails 3 (since it problably not updated to grails 3 plugin)

Add the following dependency to build.gradle:

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

I helped another user with a few rendering plugin related questions recently so this and this may be of use

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM