Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails JSON/XML generation fails
    primarykey
    data
    text
    <p>I have some code in my Controller that's throwing some unknown exceptions to me, can someone give me a hint of what is going on? see the code below:</p> <pre><code>class FooController { static allowedMethods = [save: "POST", update: "POST", delete: "POST"] def xmlList = { render Foo.list() as XML } def jsonList = { render Foo.list() as JSON } //... } </code></pre> <p>when I try to generate the JSON in the middle of it(the strangest part of it...) I get the following stacktrace:</p> <pre><code>[http-8080-2] [tenant 122] ERROR errors.GrailsExceptionResolver - Exception occurred when processing request: [GET] /project/foo/jsonList Stacktrace follows: org.codehaus.groovy.grails.web.json.JSONException: Misplaced key. at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.convertAnother(JSON.java:161) at grails.converters.JSON.value(JSON.java:198) at grails.converters.JSON.render(JSON.java:133) at grails.converters.JSON.render(JSON.java:149) at com.foo.FooController$_closure2.doCall(FooController.groovy:18) at com.foo.FooController$_closure2.doCall(FooController.groovy) at java.lang.Thread.run(Thread.java:662) </code></pre> <p>when I try to generate the xml, I get the following error on the screen:</p> <p>This page contains the following errors:</p> <p>error on line 1 at column 68: Encoding error Below is a rendering of the page up to the first error.</p> <p>and the following stacktrace:</p> <pre><code>[http-8080-2] [tenant 122] ERROR errors.GrailsExceptionResolver - Exception occurred when processing request: [GET] /project/foo/xmlList Stacktrace follows: java.lang.NullPointerException at grails.converters.XML.getElementName(XML.java:130) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.convertAnother(XML.java:173) at grails.converters.XML.render(XML.java:113) at grails.converters.XML.render(XML.java:256) at com.foo.FooController$_closure1.doCall(FooController.groovy:14) at com.foo.FooController$_closure1.doCall(FooController.groovy) at java.lang.Thread.run(Thread.java:662) </code></pre> <p>here is my Foo.groovy:</p> <pre><code>@MultiTenant class Foo { String name String description List modules = new ArrayList(); static belongsTo = [something : Something] static hasMany = [anything : Anything] static mapping = { table 'foo' version false // version is set to false, because this isn't available by default for legacy databases id generator:'identity', column:'id' sort "name" description sqlType: "text" tenantId column:'tenant_id' } static constraints = { something(blank:false) name(size:1..100, blank:false, unique:['tenantId','project']) description() } @Override String toString() { return name } } </code></pre> <p>Grails version -> 1.3.7 I'm new to grails, forgive me if I'm asking something newbieish, but I'm in real trouble here... </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload