grails-plugins/grails-java8

Should LocalDateTime and json-views plugin work with this plugin?

MayGo opened this issue · 7 comments

MayGo commented

I get error when rendering json view with LocalDateTime property:

Caused by: grails.views.ViewRenderException: Error rendering view: null
	at grails.views.AbstractWritableScript.writeTo(AbstractWritableScript.groovy:43)
	at grails.views.mvc.GenericGroovyTemplateView.renderMergedOutputModel(GenericGroovyTemplateView.groovy:73)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at grails.views.mvc.renderer.DefaultViewRenderer.render(DefaultViewRenderer.groovy:111)
	at grails.artefact.controller.RestResponder$Trait$Helper.internalRespond(RestResponder.groovy:188)
	at grails.artefact.controller.RestResponder$Trait$Helper.respond(RestResponder.groovy:98)
	... 40 common frames omitted
Caused by: java.lang.StackOverflowError: null
	at grails.plugin.json.builder.JsonOutput.writeObject(JsonOutput.java:328)
	at grails.plugin.json.builder.JsonOutput.writeIterator(JsonOutput.java:478)

I have in build.gradle:

classpath "org.grails.plugins:views-gradle:1.1.4" in buildscript.dependencies

dependencies:
compile "org.grails.plugins:grails-java8:1.1.0"
compile "org.grails.plugins:views-json:1.1.4" (tried with 1.2.0.M2 also)

I see that this repo has branch "json_views_120", that is not merged.

@MayGo Your observation about that branch is relevant. There are some features in version 1.2.0 of grails-views that are required to support the java8 stuff. That hasn't been released yet.

I'm experiencing the same problem (StackOverflowError), I don't seem to be able to use LocalDate with:
Grails 3.2.8
rest-api profile
JDK 1.8.0_121

dependencies:
compile "org.grails.plugins:grails-java8:1.2.0"
compile "org.hibernate:hibernate-java8:5.1.3.Final"

@tvergilio What version of json-views? Most likely just need to upgrade to 1.2 of json-views.

compile "org.grails.plugins:views-json"

I will try to specify version 1.2.

Sorry, do you know where I can find version 1.2 of json-views? I don't seem to be able to find it anywhere.

@tvergilio compile "org.grails.plugins:views-json:1.2.0". Also update views-gradle in the buildscript section

Thanks, for that, it was IntelliJ playing up. I installed views-json version 1.2.0 manually on my maven local and it works like a charm now.

Thanks so much for developing the plugin and making the java.time functionality available to all of us Grails users!