Divya
Divya

Reputation: 137

Could not resolve dependency for renderiing plugin in Grails 3

I added rendering plugin as dependency in build.gradle for my grails 3 project as mentioned in https://grails.org/plugin/rendering

compile ":rendering:1.0.0"

When I execute 'gradle dependencies',it says failed. It did not give me any error message but it says failed when the dependencies are listed.

These are the default repositories generated with project

repositories {

    mavenLocal()

    maven { url "https://repo.grails.org/grails/core" }
}

I tried even this way but did not work

compile "rendering:rendering:1.0.0"

Let me know if I am missing anything or the syntax is wrong.

Upvotes: 1

Views: 1103

Answers (2)

Divya
Divya

Reputation: 137

We could resolve the dependency injection issue. There was some issue with the project we were working on.So, created a new project and it is working fine. Thankyou.

But we are still having issue with render method.We are calling the render method as below to get the generate the pdf. 'pdf' template is located atviews/render/_pdf.gsp

ByteArrayOutputStream baos = new ByteArrayOutputStream();
pdfRenderingService.render([template: '/render/pdf', model: [form:"Hello text"]],baos)

It is throwing the below exception. Can anyone let us know if we are calling render method in wrong way.

Line | Method
->> 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    617 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread

Caused by NullPointerException: null
->> 1337 | getPublicDeclaredMethods in java.beans.Introspector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1197 | getTargetMethodInfo in     ''
|    426 | getBeanInfo in     ''
|    173 | getBeanInfo in     ''
|     31 | init . .  in     grails.plugins.rendering.document.RenderEnvironment
|     68 | with      in     ''
|     60 | with . .  in     ''
|     65 | generateXhtml in         grails.plugins.rendering.document.XhtmlDocumentService
|     35 | createDocument in     ''
|     36 | render    in grails.plugins.rendering.RenderingService
|     43 | buildPdf  in RenderController.groovy

Upvotes: 0

dmahapatro
dmahapatro

Reputation: 50265

Version 1.0.0 of rendering plugin is not compatible with Grails 3. Compatible version is 2.0.0-SNAPSHOT and above.

compile "org.grails.plugins:rendering:2.0.0-SNAPSHOT"

in build.gradle should be good with the repository that is currently present.

With Grails 2.*, yes you would need to use this repo: http://repo.grails.org/grails/plugins/org/grails/plugins/rendering/1.0.0/.

maven { url "https://repo.grails.org/grails/plugins" }

Upvotes: 3

Related Questions