# Simple 'create client' type script throws exception - what am I missing?

**URL:** <https://discuss.elastic.co/t/simple-create-client-type-script-throws-exception-what-am-i-missing/3564>\
**Category:** Elasticsearch\
**Created:** [November 12, 2010, 9:14pm UTC](https://discuss.elastic.co/t/simple-create-client-type-script-throws-exception-what-am-i-missing/3564 "2010-11-12T21:14:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jondow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jondow/32/2111_2.png) [@Jondow](https://discuss.elastic.co/u/Jondow)\
**Post date:** [November 12, 2010, 9:14pm UTC](https://discuss.elastic.co/t/simple-create-client-type-script-throws-exception-what-am-i-missing/3564/1 "2010-11-12T21:14:26Z")

</div>

I'm playing around with ES in the Grails console executing the  
following:

import org.elasticsearch.groovy.node.GNode  
import org.elasticsearch.groovy.node.GNodeBuilder  
import static org.elasticsearch.groovy.node.GNodeBuilder.\*

// on startup

GNodeBuilder nodeBuilder = nodeBuilder();  
nodeBuilder.settings {  
node {  
client = true  
}  
cluster {  
name = "test"  
}  
}

GNode node = nodeBuilder.node()

// on shutdown  
node.stop().close()

But when I run that, I get the following exception:  
Exception thrown

groovy.lang.MissingMethodException: No signature of method: static  
org.elasticsearch.common.xcontent.XContentFactory.contentBinaryBuilder()  
is applicable for argument types:  
(org.elasticsearch.common.xcontent.XContentType$1) values: [JSON]

```
at

```

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:  
63)

```
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

```

$buildAsBytes$0.callCurrent(Unknown Source)

```
at

```

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:  
59)

```
at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

```

$buildAsBytes.call(Unknown Source)

```
at

```

org.elasticsearch.groovy.node.GNodeBuilder.settings(GNodeBuilder.groovy:  
57)

```
at org.elasticsearch.groovy.node.GNodeBuilder$settings.call(Unknown

```

Source)

```
at ConsoleScript2.run(ConsoleScript2:22)

```

Why would there be an issue using JSON?

I should add that I have now added all the lucene JAR's in the  
elasticsearch/lib folder as well as the es groovy client JAR. Is there  
something else I'm missing?

Regards,  
Darryl

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 13, 2010, 9:12pm UTC](https://discuss.elastic.co/t/simple-create-client-type-script-throws-exception-what-am-i-missing/3564/2 "2010-11-13T21:12:35Z")

</div>

Is there a chance that you are using a different version of the  
elasticsearch groovy jar and the core elasticsearch jar?

On Fri, Nov 12, 2010 at 11:14 PM, Jondow [djpentz@gmail.com](mailto:djpentz@gmail.com) wrote:

> I'm playing around with ES in the Grails console executing the  
> following:
> 
> import org.elasticsearch.groovy.node.GNode  
> import org.elasticsearch.groovy.node.GNodeBuilder  
> import static org.elasticsearch.groovy.node.GNodeBuilder.\*
> 
> // on startup
> 
> GNodeBuilder nodeBuilder = nodeBuilder();  
> nodeBuilder.settings {  
> node {  
> client = true  
> }  
> cluster {  
> name = "test"  
> }  
> }
> 
> GNode node = nodeBuilder.node()
> 
> // on shutdown  
> node.stop().close()
> 
> But when I run that, I get the following exception:  
> Exception thrown
> 
> groovy.lang.MissingMethodException: No signature of method: static  
> org.elasticsearch.common.xcontent.XContentFactory.contentBinaryBuilder()  
> is applicable for argument types:  
> (org.elasticsearch.common.xcontent.XContentType$1) values: [JSON]
> 
> ```
> at
> 
> ```
> 
> org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:  
> 63)
> 
> ```
> at org.elasticsearch.groovy.common.xcontent.GXContentBuilder
> 
> ```
> 
> $buildAsBytes$0.callCurrent(Unknown Source)
> 
> ```
> at
> 
> ```
> 
> org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:  
> 59)
> 
> ```
> at org.elasticsearch.groovy.common.xcontent.GXContentBuilder
> 
> ```
> 
> $buildAsBytes.call(Unknown Source)
> 
> ```
> at
> 
> ```
> 
> org.elasticsearch.groovy.node.GNodeBuilder.settings(GNodeBuilder.groovy:  
> 57)
> 
> ```
> at org.elasticsearch.groovy.node.GNodeBuilder$settings.call(Unknown
> 
> ```
> 
> Source)
> 
> ```
> at ConsoleScript2.run(ConsoleScript2:22)
> 
> ```
> 
> Why would there be an issue using JSON?
> 
> I should add that I have now added all the lucene JAR's in the  
> elasticsearch/lib folder as well as the es groovy client JAR. Is there  
> something else I'm missing?
> 
> Regards,  
> Darryl

---

<div class="post-metadata">

**Author:** ![Jondow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jondow/32/2111_2.png) [@Jondow](https://discuss.elastic.co/u/Jondow)\
**Post date:** [November 16, 2010, 7:21am UTC](https://discuss.elastic.co/t/simple-create-client-type-script-throws-exception-what-am-i-missing/3564/3 "2010-11-16T07:21:12Z")

</div>

Hi Shay,

That's exactly what the problem was. I downloaded the 0.13 snapshot  
and built from source and now the same (previously problematic) code  
works just fine. Thanks for your help.

- Darryl

On Nov 13, 11:12 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Is there a chance that you are using a different version of the  
> elasticsearch groovy jar and the core elasticsearch jar?
> 
> On Fri, Nov 12, 2010 at 11:14 PM, Jondow [djpe...@gmail.com](mailto:djpe...@gmail.com) wrote:
> 
> > I'm playing around with ES in the Grails console executing the  
> > following:
> 
> > import org.elasticsearch.groovy.node.GNode  
> > import org.elasticsearch.groovy.node.GNodeBuilder  
> > import static org.elasticsearch.groovy.node.GNodeBuilder.\*
> 
> > // on startup
> 
> > GNodeBuilder nodeBuilder = nodeBuilder();  
> > nodeBuilder.settings {  
> > node {  
> > client = true  
> > }  
> > cluster {  
> > name = "test"  
> > }  
> > }
> 
> > GNode node = nodeBuilder.node()
> 
> > // on shutdown  
> > node.stop().close()
> 
> > But when I run that, I get the following exception:  
> > Exception thrown
> 
> > groovy.lang.MissingMethodException: No signature of method: static  
> > org.elasticsearch.common.xcontent.XContentFactory.contentBinaryBuilder()  
> > is applicable for argument types:  
> > (org.elasticsearch.common.xcontent.XContentType$1) values: [JSON]
> 
> > ```
> > at
> > 
> > ```
> 
> > org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:  
> > 63)
> 
> > ```
> > at org.elasticsearch.groovy.common.xcontent.GXContentBuilder
> > 
> > ```
> > 
> > $buildAsBytes$0.callCurrent(Unknown Source)
> 
> > ```
> > at
> > 
> > ```
> 
> > org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:  
> > 59)
> 
> > ```
> > at org.elasticsearch.groovy.common.xcontent.GXContentBuilder
> > 
> > ```
> > 
> > $buildAsBytes.call(Unknown Source)
> 
> > ```
> > at
> > 
> > ```
> > 
> > org.elasticsearch.groovy.node.GNodeBuilder.settings(GNodeBuilder.groovy:  
> > 57)
> 
> > ```
> > at org.elasticsearch.groovy.node.GNodeBuilder$settings.call(Unknown
> > 
> > ```
> > 
> > Source)
> 
> > ```
> > at ConsoleScript2.run(ConsoleScript2:22)
> > 
> > ```
> 
> > Why would there be an issue using JSON?
> 
> > I should add that I have now added all the lucene JAR's in the  
> > elasticsearch/lib folder as well as the es groovy client JAR. Is there  
> > something else I'm missing?
> 
> > Regards,  
> > Darryl

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:16am UTC](https://discuss.elastic.co/t/simple-create-client-type-script-throws-exception-what-am-i-missing/3564/4 "2017-07-06T04:16:27Z")

</div>


