小弟高了好长时间没搞定,来提问的,请大哥忙不看下,建立连接的时候一直提示没有class
Elasticsearch | 作者 yangshubao911 | 发布于2018年10月31日 | 阅读数:5709
private static final String HOST = "192.168.20.26"; // Elasticsearch查询服务器使用9200端口,我们可以通过RESTful API直接查询数据库。 private static final int PORT_ONE = 9200; // REST服务器使用9201端口,外部客户端可以使用它来连接和执行操作。 private static final int PORT_TWO = 9201;
restHighLevelClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(HOST, PORT_ONE, SCHEME),
new HttpHost(HOST, PORT_TWO, SCHEME)));
}
java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.client.RestHighLevelClient
restHighLevelClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(HOST, PORT_ONE, SCHEME),
new HttpHost(HOST, PORT_TWO, SCHEME)));
}
java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.client.RestHighLevelClient
2 个回复
匿名用户
赞同来自:
yangshubao911 - 码农
赞同来自:
引入:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.4.2</version>
</dependency>