Brad Whitaker
unread,Jun 22, 2011, 7:33:06 PM6/22/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to grails-jaxrs-discuss
Using latest jaxrs source from github and Grails 1.3.7 I tried the
getting started app. It works fine when I post XML but if I post this
JSON I get the following error:
post:
{
"firstName": "jason",
"lastName": "works"
}
error:
2011-06-22 16:24:47,068 [http-8080-1] ERROR
container.ContainerResponse - The RuntimeException could not be
mapped to a response, re-throwing to the HTTP container
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
cast object 'works' with class 'java.lang.String' to class
'java.util.Map'
at
org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:
331)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:
602)
at
org.grails.jaxrs.support.ConverterUtils.jsonToMap(ConverterUtils.groovy:
99)
at org.grails.jaxrs.support.ConverterUtils
$jsonToMap.callStatic(Unknown Source)
at
org.grails.jaxrs.support.DomainObjectReaderSupport.readFromJson(DomainObjectReaderSupport.groovy:
124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite
$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:
266)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:
51)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
157)
at
org.grails.jaxrs.support.DomainObjectReaderSupport.readFrom(DomainObjectReaderSupport.groovy:
93)
at
com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:
456)
Am I doing something wrong?
Thanks,
Brad