# Unable to create Transport client within native script

**URL:** <https://discuss.elastic.co/t/unable-to-create-transport-client-within-native-script/13772>\
**Category:** Elasticsearch\
**Created:** [September 26, 2013, 7:15pm UTC](https://discuss.elastic.co/t/unable-to-create-transport-client-within-native-script/13772 "2013-09-26T19:15:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clarence\_Chio](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@Clarence\_Chio](https://discuss.elastic.co/u/Clarence_Chio)\
**Post date:** [September 26, 2013, 7:15pm UTC](https://discuss.elastic.co/t/unable-to-create-transport-client-within-native-script/13772/1 "2013-09-26T19:15:30Z")

</div>

Hi all,

When I was trying to create a transport client within the execution of a  
native script, I got hit with the following "guice creation" errors that  
stumped me.

Does anyone have any pointers to give as to why I might be facing these  
problems?

This is my code section:

```
    ...
    Settings settings = ImmutableSettings.settingsBuilder()
      .put("cluster.name", "spp01").build();
    Client client = new TransportClient(settings)
      .addTransportAddress(new InetSocketTransportAddress("localhost", 

```

9300));;  
...

These are the errors:

at  
org.elasticsearch.search.SearchService.parseSource(SearchService.java:577)  
at  
org.elasticsearch.search.SearchService.createContext(SearchService.java:488)  
at  
org.elasticsearch.search.SearchService.createContext(SearchService.java:473)  
at  
org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:466)  
at  
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:238)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:529)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:518)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:269)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
at java.lang.Thread.run(Unknown Source)  
Caused by: org.elasticsearch.index.query.QueryParsingException:  
[productsearch] [custom\_score] the script could not be loaded  
at  
org.elasticsearch.index.query.CustomScoreQueryParser.parse(CustomScoreQueryParser.java:111)  
at  
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:202)  
at  
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:276)  
at  
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:254)  
at  
org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)  
at  
org.elasticsearch.search.SearchService.parseSource(SearchService.java:565)  
... 10 more  
Caused by: org.elasticsearch.common.inject.CreationException: Guice  
creation errors:

1. No implementation for java.util.Map\<java.lang.String,  
org.elasticsearch.monitor.dump.DumpContributorFactory\> was bound.  
at Key[type=java.util.Map\<java.lang.String,  
org.elasticsearch.monitor.dump.DumpContributorFactory\>,  
annotation=[none]]@org.elasticsearch.monitor.dump.DumpMonitorService.()[3]  
at Key[type=org.elasticsearch.monitor.dump.DumpMonitorService,  
annotation=[none]]@org.elasticsearch.monitor.jvm.JvmMonitorService.()[2]  
at Key[type=org.elasticsearch.monitor.jvm.JvmMonitorService,  
annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[1]  
at Key[type=org.elasticsearch.monitor.MonitorService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

2. No implementation for org.elasticsearch.cluster.ClusterService was bound.  
at Key[type=org.elasticsearch.cluster.ClusterService,  
annotation=[none]]@org.elasticsearch.monitor.dump.DumpMonitorService.()[2]  
at Key[type=org.elasticsearch.monitor.dump.DumpMonitorService,  
annotation=[none]]@org.elasticsearch.monitor.jvm.JvmMonitorService.()[2]  
at Key[type=org.elasticsearch.monitor.jvm.JvmMonitorService,  
annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[1]  
at Key[type=org.elasticsearch.monitor.MonitorService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

3. No implementation for org.elasticsearch.cluster.ClusterService was bound.  
at Key[type=org.elasticsearch.cluster.ClusterService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[4]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

4. No implementation for org.elasticsearch.discovery.Discovery was bound.  
at Key[type=org.elasticsearch.discovery.Discovery,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[3]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

5. No implementation for org.elasticsearch.indices.IndicesService was bound.  
at Key[type=org.elasticsearch.indices.IndicesService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[6]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

6. No implementation for org.elasticsearch.monitor.fs.FsProbe was bound.  
at Key[type=org.elasticsearch.monitor.fs.FsProbe,  
annotation=[none]]@org.elasticsearch.monitor.fs.FsService.()[1]  
at Key[type=org.elasticsearch.monitor.fs.FsService,  
annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[6]  
at Key[type=org.elasticsearch.monitor.MonitorService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

7. No implementation for org.elasticsearch.monitor.network.NetworkProbe was  
bound.  
at Key[type=org.elasticsearch.monitor.network.NetworkProbe,  
annotation=[none]]@org.elasticsearch.monitor.network.NetworkService.()[1]  
at Key[type=org.elasticsearch.monitor.network.NetworkService,  
annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[5]  
at Key[type=org.elasticsearch.monitor.MonitorService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

8. No implementation for org.elasticsearch.monitor.os.OsProbe was bound.  
at Key[type=org.elasticsearch.monitor.os.OsProbe,  
annotation=[none]]@org.elasticsearch.monitor.os.OsService.()[1]  
at Key[type=org.elasticsearch.monitor.os.OsService,  
annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[2]  
at Key[type=org.elasticsearch.monitor.MonitorService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

9. No implementation for org.elasticsearch.monitor.process.ProcessProbe was  
bound.  
at Key[type=org.elasticsearch.monitor.process.ProcessProbe,  
annotation=[none]]@org.elasticsearch.monitor.process.ProcessService.()[1]  
at Key[type=org.elasticsearch.monitor.process.ProcessService,  
annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[3]  
at Key[type=org.elasticsearch.monitor.MonitorService,  
annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
at Key[type=org.elasticsearch.node.service.NodeService,  
annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
at _unknown_

9 errors  
at  
org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)  
at  
org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:151)  
at  
org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:102)  
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)  
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)  
at  
org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)  
at  
org.elasticsearch.client.transport.TransportClient.(TransportClient.java:183)  
at  
org.elasticsearch.client.transport.TransportClient.(TransportClient.java:121)  
at  
org.zazzle.customscoring.CustomScript$Scorer.seamlessSwitch(CustomScript.java:72)  
at org.zazzle.customscoring.CustomScript.reload(CustomScript.java:234)  
at org.zazzle.customscoring.CustomScript.(CustomScript.java:190)  
at  
org.zazzle.customscoring.CustomScriptFactory.newScript(CustomScriptFactory.java:14)  
at  
org.elasticsearch.script.NativeScriptEngineService.search(NativeScriptEngineService.java:73)  
at org.elasticsearch.script.ScriptService.search(ScriptService.java:190)  
at org.elasticsearch.script.ScriptService.search(ScriptService.java:194)  
at  
org.elasticsearch.index.query.CustomScoreQueryParser.parse(CustomScoreQueryParser.java:109)  
... 15 more

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 4, 2013, 2:01pm UTC](https://discuss.elastic.co/t/unable-to-create-transport-client-within-native-script/13772/2 "2013-10-04T14:01:21Z")

</div>

Hey,

can you explain, what do you want to achieve? I think it is not a good idea  
to create a TransportClient inside of a script, but maybe we ca work around  
that issue in a different way?

thanks!

--Alex

On Thu, Sep 26, 2013 at 9:15 PM, cchio [chiochio@gmail.com](mailto:chiochio@gmail.com) wrote:

> Hi all,
> 
> When I was trying to create a transport client within the execution of a  
> native script, I got hit with the following "guice creation" errors that  
> stumped me.
> 
> Does anyone have any pointers to give as to why I might be facing these  
> problems?
> 
> This is my code section:
> 
> ```
> ...
> Settings settings = ImmutableSettings.settingsBuilder()
> .put("cluster.name", "spp01").build();
> Client client = new TransportClient(settings)
> .addTransportAddress(new InetSocketTransportAddress("localhost",
> 
> ```
> 
> 9300));;  
> ...
> 
> These are the errors:
> 
> at  
> org.elasticsearch.search.SearchService.parseSource(SearchService.java:577)  
> at  
> org.elasticsearch.search.SearchService.createContext(SearchService.java:488)  
> at  
> org.elasticsearch.search.SearchService.createContext(SearchService.java:473)  
> at  
> org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:466)  
> at  
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:238)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:529)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:518)  
> at  
> org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:269)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
> at java.lang.Thread.run(Unknown Source)  
> Caused by: org.elasticsearch.index.query.QueryParsingException:  
> [productsearch] [custom\_score] the script could not be loaded  
> at  
> org.elasticsearch.index.query.CustomScoreQueryParser.parse(CustomScoreQueryParser.java:111)  
> at  
> org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:202)  
> at  
> org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:276)  
> at  
> org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:254)  
> at  
> org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)  
> at  
> org.elasticsearch.search.SearchService.parseSource(SearchService.java:565)  
> ... 10 more  
> Caused by: org.elasticsearch.common.inject.CreationException: Guice  
> creation errors:
> 
> 1. No implementation for java.util.Map\<java.lang.String,  
> org.elasticsearch.monitor.dump.DumpContributorFactory\> was bound.  
> at Key[type=java.util.Map\<java.lang.String,  
> org.elasticsearch.monitor.dump.DumpContributorFactory\>,  
> annotation=[none]]@org.elasticsearch.monitor.dump.DumpMonitorService.()[3]  
> at Key[type=org.elasticsearch.monitor.dump.DumpMonitorService,  
> annotation=[none]]@org.elasticsearch.monitor.jvm.JvmMonitorService.()[2]  
> at Key[type=org.elasticsearch.monitor.jvm.JvmMonitorService,  
> annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[1]  
> at Key[type=org.elasticsearch.monitor.MonitorService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 2. No implementation for org.elasticsearch.cluster.ClusterService was  
> bound.  
> at Key[type=org.elasticsearch.cluster.ClusterService,  
> annotation=[none]]@org.elasticsearch.monitor.dump.DumpMonitorService.()[2]  
> at Key[type=org.elasticsearch.monitor.dump.DumpMonitorService,  
> annotation=[none]]@org.elasticsearch.monitor.jvm.JvmMonitorService.()[2]  
> at Key[type=org.elasticsearch.monitor.jvm.JvmMonitorService,  
> annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[1]  
> at Key[type=org.elasticsearch.monitor.MonitorService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 3. No implementation for org.elasticsearch.cluster.ClusterService was  
> bound.  
> at Key[type=org.elasticsearch.cluster.ClusterService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[4]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 4. No implementation for org.elasticsearch.discovery.Discovery was bound.  
> at Key[type=org.elasticsearch.discovery.Discovery,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[3]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 5. No implementation for org.elasticsearch.indices.IndicesService was  
> bound.  
> at Key[type=org.elasticsearch.indices.IndicesService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[6]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 6. No implementation for org.elasticsearch.monitor.fs.FsProbe was bound.  
> at Key[type=org.elasticsearch.monitor.fs.FsProbe,  
> annotation=[none]]@org.elasticsearch.monitor.fs.FsService.()[1]  
> at Key[type=org.elasticsearch.monitor.fs.FsService,  
> annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[6]  
> at Key[type=org.elasticsearch.monitor.MonitorService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 7. No implementation for org.elasticsearch.monitor.network.NetworkProbe  
> was bound.  
> at Key[type=org.elasticsearch.monitor.network.NetworkProbe,  
> annotation=[none]]@org.elasticsearch.monitor.network.NetworkService.()[1]  
> at Key[type=org.elasticsearch.monitor.network.NetworkService,  
> annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[5]  
> at Key[type=org.elasticsearch.monitor.MonitorService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 8. No implementation for org.elasticsearch.monitor.os.OsProbe was bound.  
> at Key[type=org.elasticsearch.monitor.os.OsProbe,  
> annotation=[none]]@org.elasticsearch.monitor.os.OsService.()[1]  
> at Key[type=org.elasticsearch.monitor.os.OsService,  
> annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[2]  
> at Key[type=org.elasticsearch.monitor.MonitorService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 9. No implementation for org.elasticsearch.monitor.process.ProcessProbe  
> was bound.  
> at Key[type=org.elasticsearch.monitor.process.ProcessProbe,  
> annotation=[none]]@org.elasticsearch.monitor.process.ProcessService.()[1]  
> at Key[type=org.elasticsearch.monitor.process.ProcessService,  
> annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[3]  
> at Key[type=org.elasticsearch.monitor.MonitorService,  
> annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> at Key[type=org.elasticsearch.node.service.NodeService,  
> annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> at _unknown_
> 
> 9 errors  
> at  
> org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)  
> at  
> org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:151)  
> at  
> org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:102)  
> at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)  
> at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)  
> at  
> org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)  
> at  
> org.elasticsearch.client.transport.TransportClient.(TransportClient.java:183)  
> at  
> org.elasticsearch.client.transport.TransportClient.(TransportClient.java:121)  
> at  
> org.zazzle.customscoring.CustomScript$Scorer.seamlessSwitch(CustomScript.java:72)  
> at org.zazzle.customscoring.CustomScript.reload(CustomScript.java:234)  
> at org.zazzle.customscoring.CustomScript.(CustomScript.java:190)  
> at  
> org.zazzle.customscoring.CustomScriptFactory.newScript(CustomScriptFactory.java:14)  
> at  
> org.elasticsearch.script.NativeScriptEngineService.search(NativeScriptEngineService.java:73)  
> at org.elasticsearch.script.ScriptService.search(ScriptService.java:190)  
> at org.elasticsearch.script.ScriptService.search(ScriptService.java:194)  
> at  
> org.elasticsearch.index.query.CustomScoreQueryParser.parse(CustomScoreQueryParser.java:109)  
> ... 15 more
> 
> Thanks!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [October 4, 2013, 7:20pm UTC](https://discuss.elastic.co/t/unable-to-create-transport-client-within-native-script/13772/3 "2013-10-04T19:20:10Z")

</div>

I agree with Alex, it's doesn't make much sense to instantiate  
TransportClient inside native script if all you want to do is connect back  
to the cluster. You can simply inject Node into your script Factory and get  
client from there. You can find an example of this technique here[https://github.com/imotov/elasticsearch-native-script-example/blob/master/src/main/java/org/elasticsearch/examples/nativescript/script/LookupScript.java#L52](https://github.com/imotov/elasticsearch-native-script-example/blob/master/src/main/java/org/elasticsearch/examples/nativescript/script/LookupScript.java#L52).  
One thing that you should consider is that depending on where this script  
will be called, it might get executed very large number of times. Therefore  
using client on each call might really slow things down.

On Friday, October 4, 2013 10:01:21 AM UTC-4, Alexander Reelsen wrote:

> Hey,
> 
> can you explain, what do you want to achieve? I think it is not a good  
> idea to create a TransportClient inside of a script, but maybe we ca work  
> around that issue in a different way?
> 
> thanks!
> 
> --Alex
> 
> On Thu, Sep 26, 2013 at 9:15 PM, cchio \<[chio...@gmail.com](mailto:chio...@gmail.com) \<javascript:\>\>wrote:
> 
> > Hi all,
> > 
> > When I was trying to create a transport client within the execution of a  
> > native script, I got hit with the following "guice creation" errors that  
> > stumped me.
> > 
> > Does anyone have any pointers to give as to why I might be facing these  
> > problems?
> > 
> > This is my code section:
> > 
> > ```
> > ...
> > Settings settings = ImmutableSettings.settingsBuilder()
> > .put("cluster.name", "spp01").build();
> > Client client = new TransportClient(settings)
> > .addTransportAddress(new 
> > 
> > ```
> > 
> > InetSocketTransportAddress("localhost", 9300));;  
> > ...
> > 
> > These are the errors:
> > 
> > at  
> > org.elasticsearch.search.SearchService.parseSource(SearchService.java:577)  
> > at  
> > org.elasticsearch.search.SearchService.createContext(SearchService.java:488)  
> > at  
> > org.elasticsearch.search.SearchService.createContext(SearchService.java:473)  
> > at  
> > org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:466)  
> > at  
> > org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:238)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:529)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:518)  
> > at  
> > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:269)  
> > at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
> > at java.lang.Thread.run(Unknown Source)  
> > Caused by: org.elasticsearch.index.query.QueryParsingException:  
> > [productsearch] [custom\_score] the script could not be loaded  
> > at  
> > org.elasticsearch.index.query.CustomScoreQueryParser.parse(CustomScoreQueryParser.java:111)  
> > at  
> > org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:202)  
> > at  
> > org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:276)  
> > at  
> > org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:254)  
> > at  
> > org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)  
> > at  
> > org.elasticsearch.search.SearchService.parseSource(SearchService.java:565)  
> > ... 10 more  
> > Caused by: org.elasticsearch.common.inject.CreationException: Guice  
> > creation errors:
> > 
> > 1. No implementation for java.util.Map\<java.lang.String,  
> > org.elasticsearch.monitor.dump.DumpContributorFactory\> was bound.  
> > at Key[type=java.util.Map\<java.lang.String,  
> > org.elasticsearch.monitor.dump.DumpContributorFactory\>,  
> > annotation=[none]]@org.elasticsearch.monitor.dump.DumpMonitorService.()[3]  
> > at Key[type=org.elasticsearch.monitor.dump.DumpMonitorService,  
> > annotation=[none]]@org.elasticsearch.monitor.jvm.JvmMonitorService.()[2]  
> > at Key[type=org.elasticsearch.monitor.jvm.JvmMonitorService,  
> > annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[1]  
> > at Key[type=org.elasticsearch.monitor.MonitorService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 2. No implementation for org.elasticsearch.cluster.ClusterService was  
> > bound.  
> > at Key[type=org.elasticsearch.cluster.ClusterService,  
> > annotation=[none]]@org.elasticsearch.monitor.dump.DumpMonitorService.()[2]  
> > at Key[type=org.elasticsearch.monitor.dump.DumpMonitorService,  
> > annotation=[none]]@org.elasticsearch.monitor.jvm.JvmMonitorService.()[2]  
> > at Key[type=org.elasticsearch.monitor.jvm.JvmMonitorService,  
> > annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[1]  
> > at Key[type=org.elasticsearch.monitor.MonitorService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 3. No implementation for org.elasticsearch.cluster.ClusterService was  
> > bound.  
> > at Key[type=org.elasticsearch.cluster.ClusterService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[4]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 4. No implementation for org.elasticsearch.discovery.Discovery was bound.  
> > at Key[type=org.elasticsearch.discovery.Discovery,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[3]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 5. No implementation for org.elasticsearch.indices.IndicesService was  
> > bound.  
> > at Key[type=org.elasticsearch.indices.IndicesService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[6]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 6. No implementation for org.elasticsearch.monitor.fs.FsProbe was bound.  
> > at Key[type=org.elasticsearch.monitor.fs.FsProbe,  
> > annotation=[none]]@org.elasticsearch.monitor.fs.FsService.()[1]  
> > at Key[type=org.elasticsearch.monitor.fs.FsService,  
> > annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[6]  
> > at Key[type=org.elasticsearch.monitor.MonitorService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 7. No implementation for org.elasticsearch.monitor.network.NetworkProbe  
> > was bound.  
> > at Key[type=org.elasticsearch.monitor.network.NetworkProbe,  
> > annotation=[none]]@org.elasticsearch.monitor.network.NetworkService.()[1]  
> > at Key[type=org.elasticsearch.monitor.network.NetworkService,  
> > annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[5]  
> > at Key[type=org.elasticsearch.monitor.MonitorService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 8. No implementation for org.elasticsearch.monitor.os.OsProbe was bound.  
> > at Key[type=org.elasticsearch.monitor.os.OsProbe,  
> > annotation=[none]]@org.elasticsearch.monitor.os.OsService.()[1]  
> > at Key[type=org.elasticsearch.monitor.os.OsService,  
> > annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[2]  
> > at Key[type=org.elasticsearch.monitor.MonitorService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 9. No implementation for org.elasticsearch.monitor.process.ProcessProbe  
> > was bound.  
> > at Key[type=org.elasticsearch.monitor.process.ProcessProbe,  
> > annotation=[none]]@org.elasticsearch.monitor.process.ProcessService.()[1]  
> > at Key[type=org.elasticsearch.monitor.process.ProcessService,  
> > annotation=[none]]@org.elasticsearch.monitor.MonitorService.()[3]  
> > at Key[type=org.elasticsearch.monitor.MonitorService,  
> > annotation=[none]]@org.elasticsearch.node.service.NodeService.()[2]  
> > at Key[type=org.elasticsearch.node.service.NodeService,  
> > annotation=[none]]@org.elasticsearch.thrift.ThriftServer.()[2]  
> > at _unknown_
> > 
> > 9 errors  
> > at  
> > org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)  
> > at  
> > org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:151)  
> > at  
> > org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:102)  
> > at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)  
> > at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)  
> > at  
> > org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)  
> > at  
> > org.elasticsearch.client.transport.TransportClient.(TransportClient.java:183)  
> > at  
> > org.elasticsearch.client.transport.TransportClient.(TransportClient.java:121)  
> > at  
> > org.zazzle.customscoring.CustomScript$Scorer.seamlessSwitch(CustomScript.java:72)  
> > at org.zazzle.customscoring.CustomScript.reload(CustomScript.java:234)  
> > at org.zazzle.customscoring.CustomScript.(CustomScript.java:190)  
> > at  
> > org.zazzle.customscoring.CustomScriptFactory.newScript(CustomScriptFactory.java:14)  
> > at  
> > org.elasticsearch.script.NativeScriptEngineService.search(NativeScriptEngineService.java:73)  
> > at org.elasticsearch.script.ScriptService.search(ScriptService.java:190)  
> > at org.elasticsearch.script.ScriptService.search(ScriptService.java:194)  
> > at  
> > org.elasticsearch.index.query.CustomScoreQueryParser.parse(CustomScoreQueryParser.java:109)  
> > ... 15 more
> > 
> > Thanks!
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:13am UTC](https://discuss.elastic.co/t/unable-to-create-transport-client-within-native-script/13772/4 "2017-07-06T02:13:42Z")

</div>


