Elasticsearch报错:java.lang.NoSuchMethodError: Could not initialize class org.elasticsearch.http.netty

Elasticsearch相关问题:

java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.http.netty4.Netty4HttpServerTransport

	at org.elasticsearch.transport.Netty4Plugin.getSettings(Netty4Plugin.java:56)...

pom依赖相关:使用transport、elasticsearch

<dependency>
      <groupId>org.elasticsearch.clientgroupId>
      <artifactId>transportartifactId>
      <version>5.5.2version>
 dependency>
<dependency>
       <groupId>org.elasticsearchgroupId>
       <artifactId>elasticsearchartifactId>
       <version>5.5.2version>
dependency>

或者是spring-boot-starter-data-elasticsearch时

<dependency>
   <groupId>org.springframework.bootgroupId>
   <artifactId>spring-boot-starter-data-elasticsearchartifactId>
dependency>

原因:transport缺少netty4相关依赖

此处导入5.4.3版本

<dependency>
       <groupId>org.elasticsearch.plugingroupId>
       <artifactId>transport-netty4-clientartifactId>
       <version>5.4.3version>
dependency>

导入后就能正常启动了

你可能感兴趣的:(springcloud)