Home > Enterprise >  Error on starting Elastic Transport client - Unsupported transport.type [netty4]
Error on starting Elastic Transport client - Unsupported transport.type [netty4]

Time:12-30

I'm migrating code from elastic 5 to 7

Elastic dependency in pom :

 <elastic.version>7.12.1</elastic.version>

 <dependency>
  <groupId>org.elasticsearch</groupId>
  <artifactId>elasticsearch</artifactId>
  <version>${elastic.version}</version>
</dependency>

<dependency>
  <groupId>org.elasticsearch.client</groupId>
  <artifactId>transport</artifactId>
  <version>${elastic.version}</version>
</dependency>

<dependency>
  <groupId>org.elasticsearch.client</groupId>
  <artifactId>elasticsearch-rest-high-level-client</artifactId>
  <version>${elastic.version}</version>
</dependency>

The client init looks like this:

val settings = Settings.builder()
  .put("cluster.name", cluster)
  .put("client.transport.sniff", true)
  .build()

val clientBase:TransportClient = new PreBuiltTransportClient(settings)
val client = hosts.foldLeft(clientBase)((c,h) =>
  c.addTransportAddress(new TransportAddress(InetAddress.getByName(h), port))
)

When Running the code getting the following error:

 Caused by: java.lang.IllegalStateException: Unsupported transport.type [netty4]
at org.elasticsearch.common.network.NetworkModule.getTransportSupplier(NetworkModule.java:201)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:186)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:282)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:119)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:105)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:95)

Please advise how to fix it

CodePudding user response:

Looks like you need to add transport-netty4-client as a dependency, see this answer

  • Related