grails - grails3 Ajax Request Breaking after render as JSON -


i migrating application grails 2.4.4 grails 3.1.5 grails security plugin.

i using grails ajax request plugin make ajax calls getting error after calling ajax.

i returning arraylist of pojo , not pogo objects gotten api call

state/stateforcountry - parameters: countryname: ghana stacktrace follows: java.lang.reflect.invocationtargetexception: null         @ grails.plugin.springsecurity.web.filter.grailsanonymousauthenticationfilter.dofilter(grailsanonymousauthenticationfilter.groovy:53)         @ grails.plugin.springsecurity.web.authentication.logout.mutablelogoutfilter.dofilter(mutablelogoutfilter.groovy:62)         @ grails.plugin.springsecurity.web.securityrequestholderfilter.dofilter(securityrequestholderfilter.groovy:58)         @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142)         @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617)         @ java.lang.thread.run(thread.java:745) caused by: java.lang.nullpointerexception: null         @ grails.converters.json.value(json.java:180)         @ grails.converters.json.convertanother(json.java:144)         @ grails.converters.json.value(json.java:184)         @ grails.converters.json.render(json.java:119)         @ grails.converters.json.render(json.java:132)         @ grails.artefact.controller.support.responserenderer$trait$helper.render(responserenderer.groovy:191)         @ smartinsure.admin.statecontroller$_stateforcountry_closure1$_closure2.docall(statecontroller.groovy:29)         @ grails.artefact.controller$trait$helper.withformat(controller.groovy:92)         @ smartinsure.admin.statecontroller.stateforcountry(statecontroller.groovy:28)         ... 6 common frames omitted 

can out?

i solved using groovy conversion api groovy.json package

def getusers(){    def users = userservice.getallusers();    render jsonoutput.tojson(users); } 

as opposed render users json. jsonoutput in groovy.json package or better still

withformat {       html { render view:"edit", model:users}       json { render jsonoutput.tojson(users)}       xml { render users xml} } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -