Elasticseatch 5.0.0 NoSuchMethodError PreBuiltTransportClient.addPlugins

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)

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.

Daniel

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