Elasticsearch TransportClient NetworkPlugin NoClassDefFoundError Elasticsearch TransportClient NetworkPlugin NoClassDefFoundError elasticsearch elasticsearch

Elasticsearch TransportClient NetworkPlugin NoClassDefFoundError


I just stumbled over the same problem. Seems that the Elasticsearch docs aren't complete. In addition to the transport client dependency, you need to also add the elasticsearch dependency:

<dependency>    <groupId>org.elasticsearch</groupId>    <artifactId>elasticsearch</artifactId>    <version>5.1.1</version></dependency>

You'll also need the log4j dependency, but that is clearly stated in the Elasticsearch docs.


for me it looks like elastic search has a wrong dependency version in the pom

  <properties>    <log4j.version>2.6.2</log4j.version></properties><dependencies>  <dependency>    <groupId>org.elasticsearch</groupId>    <artifactId>elasticsearch</artifactId>    <version>5.1.1</version>  </dependency>  <dependency>    <groupId>org.elasticsearch.client</groupId>    <artifactId>transport</artifactId>    <version>5.1.1</version>    <exclusions>      <exclusion>        <artifactId>elasticsearch</artifactId>                    <groupId>org.elasticsearch</groupId></exclusion>    </exclusions>  </dependency>         <dependency>        <groupId>org.apache.logging.log4j</groupId>        <artifactId>log4j-api</artifactId>        <version>${log4j.version}</version>    </dependency>    <dependency>        <groupId>org.apache.logging.log4j</groupId>        <artifactId>log4j-core</artifactId>        <version>${log4j.version}</version>    </dependency>    <dependency>        <groupId>org.apache.logging.log4j</groupId>        <artifactId>log4j-web</artifactId>        <version>${log4j.version}</version>    </dependency>

try to replace the version with 5.1.1 well it looks like it also needs log4j ?!

best regards, noirabys


As stated in this issue on Elasticsearch Github pages, SpringBoot starter manages some default dependencies, which defined the default version of ElasticSearch below 5.1.1, so that there is no such class.

You can explicitly define the property in your own pom to override its definition.

<properties>    <elasticsearch.version>5.1.1</elasticsearch.version></properties>

Hope it helps.