# Elasticseatch 5.0.0 NoSuchMethodError PreBuiltTransportClient.addPlugins

**URL:** https://discuss.elastic.co/t/elasticseatch-5-0-0-nosuchmethoderror-prebuilttransportclient-addplugins/65912
**Category:** Elasticsearch
**Created:** [November 13, 2016, 2:29pm UTC](https://discuss.elastic.co/t/elasticseatch-5-0-0-nosuchmethoderror-prebuilttransportclient-addplugins/65912 "2016-11-13T14:29:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Andre\_Fedorenko](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Andre\_Fedorenko](https://discuss.elastic.co/u/Andre_Fedorenko)
#### Post date: [November 13, 2016, 2:29pm UTC](https://discuss.elastic.co/t/elasticseatch-5-0-0-nosuchmethoderror-prebuilttransportclient-addplugins/65912/1 "2016-11-13T14:29:59Z")

</div>

Hi guys,

I need a little help with new elasticsearch

i made a small client for testing

@Singleton  
@Startup  
public class NativeElasticSingleton {

```
private TransportClient client;

@PostConstruct
private void init() {
	
	try {
		
		client = new PreBuiltTransportClient(Settings.EMPTY)
		        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
		        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));
	} catch (UnknownHostException e) {

	}

}

```

i debug a little and it try to add the native plugins  
Arrays.asList(  
Netty3Plugin.class,  
Netty4Plugin.class,  
ReindexPlugin.class,  
PercolatorPlugin.class,  
MustachePlugin.class));

and i'm getting

Caused by: java.lang.NoSuchMethodError: org.elasticsearch.transport.client.PreBuiltTransportClient.addPlugins(Ljava/util/Collection;Ljava/util/Collection;)Ljava/util/Collection;  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:69)  
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:65)

---

<div class="post-metadata">

### Author: ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)
#### Post date: [November 14, 2016, 7:35am UTC](https://discuss.elastic.co/t/elasticseatch-5-0-0-nosuchmethoderror-prebuilttransportclient-addplugins/65912/2 "2016-11-14T07:35:10Z")

</div>

Hi @Andre_Fedorenko,

`java.lang.NoSuchMethodError` when a method was present at compile time but was not found at runtime. It sounds to me that you tried to call the method in an IDE debug window. Did you notice that the method `addPlugins` is declared as `protected`? You are supposed to add plugins only in the constructor of `PreBuiltTransportClient`. You can see an [example in our client benchmarks](https://github.com/elastic/elasticsearch/blob/194a6b1df031a95977b6ca395a74a8b74d9af31d/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/transport/TransportClientBenchmark.java#L52-L56).

Daniel

---

<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: [December 12, 2016, 7:35am UTC](https://discuss.elastic.co/t/elasticseatch-5-0-0-nosuchmethoderror-prebuilttransportclient-addplugins/65912/3 "2016-12-12T07:35:14Z")

</div>

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