Maybe its the part that transforms the closure to a json? Where is the
failure coming from? If so, I just took that code from grails, it seems to
have its quirks, not sure why since I am not a groovy expert...
On Fri, Jan 20, 2012 at 4:02 PM, Mark Johnson Mark@k-int.com wrote:
Im using Groovy. With the following query below im getting the error
(bold). can anyone tell me where I am going wrong with my query,
cheers
Class
java.lang.NullPointerException
Message
Cannot invoke method getAt() on null object
Keep in mind that what you're writing is groovy, not actual JSON.
JSONBuilder (grails) is there to provide a DSL. I typically just write pure
groovy code because of all the JSONBuilder quirks. It also makes modifying
query objects easier.
Try converting your filter object to a groovy map. This is essentially what
JSONBuilder would produce anyway (a map from a closure).
Heya all.. I've been looking at this for mark over the weekend... The stack-trace is attached below. It seems to cleanly describe the method calls assigned via the metaClass. Reading the code for GCContextBuilder there are some references to an element() call that I can't quite put into context... If anyone can point me in the right direction I'm more than happy to dig deeper...
Eric, you suggest compiling a pure json object, but I can't see a way to pass a pure groovy map through GClient... Are you suggesting doing away with GClient altogether and then just using a http client to post a manually constructed json object at the server?
Cheers all, any ideas most welcome!
Ian.
Cannot invoke method getAt() on null object. Stacktrace follows:
java.lang.NullPointerException: Cannot invoke method getAt() on null object
at com.k_int.xcri.SearchController$_index_closure1_closure3_closure4_closure6_closure8_closure9$$ENMgvvLk.doCall(SearchController.groovy:54)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.handleClosureNode(GXContentBuilder.groovy:156)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.invokeMethod(GXContentBuilder.groovy:118)
at com.k_int.xcri.SearchController$_index_closure1_closure3_closure4_closure6_closure8$$ENMgvvLk.doCall(SearchController.groovy:52)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.handleClosureNode(GXContentBuilder.groovy:156)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.invokeMethod(GXContentBuilder.groovy:118)
at com.k_int.xcri.SearchController$_index_closure1_closure3_closure4_closure6$$ENMgvvLk.doCall(SearchController.groovy:51)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.handleClosureNode(GXContentBuilder.groovy:156)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.invokeMethod(GXContentBuilder.groovy:118)
at com.k_int.xcri.SearchController$_index_closure1_closure3_closure4$$ENMgvvLk.doCall(SearchController.groovy:47)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.handleClosureNode(GXContentBuilder.groovy:156)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.invokeMethod(GXContentBuilder.groovy:118)
at com.k_int.xcri.SearchController$_index_closure1_closure3$$ENMgvvLk.doCall(SearchController.groovy:45)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildRoot(GXContentBuilder.groovy:73)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.build(GXContentBuilder.groovy:47)
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:63)
at org.elasticsearch.groovy.client.GClient$__clinit__closure15.doCall(GClient.groovy:107)
at com.k_int.xcri.SearchController$_index_closure1$$ENMgvvLk.doCall(SearchController.groovy:42)
at org.elasticsearch.groovy.client.GClient.search(GClient.groovy:308)
at com.k_int.xcri.SearchController$$ENMgvvLk.index(SearchController.groovy:82)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.