# Unable to start TransportClient : RandomizedContext#getRandom

**URL:** <https://discuss.elastic.co/t/unable-to-start-transportclient-randomizedcontext-getrandom/85466>\
**Category:** Elasticsearch\
**Created:** [May 11, 2017, 7:08pm UTC](https://discuss.elastic.co/t/unable-to-start-transportclient-randomizedcontext-getrandom/85466 "2017-05-11T19:08:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic\_boston](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elastic\_boston](https://discuss.elastic.co/u/elastic_boston)\
**Post date:** [May 11, 2017, 7:08pm UTC](https://discuss.elastic.co/t/unable-to-start-transportclient-randomizedcontext-getrandom/85466/1 "2017-05-11T19:08:49Z")

</div>

I am unable to start a transport client. My code is -

```
Settings settings = Settings.builder()
	       .put("client.transport.sniff", true).build();

TransportClient client = new PreBuiltTransportClient(settings)
	     .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

```

The error I get is as below. Note I am not running any unit tests, though there may be some unit tests in the classpath. I have checked that none of them have  
@RunWith (Parameterized.class)

I think it is dues to some maven dependancies, but I don't know which one - and I have a gigantic pom.xml and lots of associated files. So I don't know what to update!

[2017-05-11T15:01:49,998][INFO][o.e.p.PluginsService] [_client_] no modules loaded  
[2017-05-11T15:01:50,003][INFO][o.e.p.PluginsService] [_client_] loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]  
[2017-05-11T15:01:50,003][INFO][o.e.p.PluginsService] [_client_] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]  
[2017-05-11T15:01:50,003][INFO][o.e.p.PluginsService] [_client_] loaded plugin [org.elasticsearch.script.mustache.MustachePlugin]  
[2017-05-11T15:01:50,003][INFO][o.e.p.PluginsService] [_client_] loaded plugin [org.elasticsearch.transport.Netty3Plugin]  
[2017-05-11T15:01:50,003][INFO][o.e.p.PluginsService] [_client_] loaded plugin [org.elasticsearch.transport.Netty4Plugin]  
Exception in thread "main" java.lang.IllegalStateException: running tests but failed to invoke RandomizedContext#getRandom  
at org.elasticsearch.common.Randomness.get(Randomness.java:105)  
at org.elasticsearch.client.transport.TransportClientNodesService.(TransportClientNodesService.java:96)  
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:187)  
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:258)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:125)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:111)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:101)

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [May 13, 2017, 2:00am UTC](https://discuss.elastic.co/t/unable-to-start-transportclient-randomizedcontext-getrandom/85466/2 "2017-05-13T02:00:41Z")

</div>

That's the problem, you have randomized runner on your class path. You need to use the Maven dependency tree to find out where it is coming from.

---

<div class="post-metadata">

**Author:** ![elastic\_boston](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elastic\_boston](https://discuss.elastic.co/u/elastic_boston)\
**Post date:** [May 15, 2017, 4:29pm UTC](https://discuss.elastic.co/t/unable-to-start-transportclient-randomizedcontext-getrandom/85466/3 "2017-05-15T16:29:00Z")

</div>

I think we need to use the Randomized runner to create a PreBuiltTransportClient?

I have tried using the annotation on my test class as  
@RunWith(com.carrotsearch.randomizedtesting.RandomizedRunner.class)

but this produces threading issues.  
(Even if I use annotation)  
@ThreadLeakScope(ThreadLeakScope.Scope.NONE)

---

<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:** [June 12, 2017, 4:39pm UTC](https://discuss.elastic.co/t/unable-to-start-transportclient-randomizedcontext-getrandom/85466/4 "2017-06-12T16:39:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
