java.lang.NoClassDefFoundError: org/elasticsearch/script/mustache/SearchTemplateRequest
java.lang.NoClassDefFoundError: org/elasticsearch/script/mustache/SearchTemplateRequest
我正在尝试使用 java 程序中的 RestHighLevelClient
访问 Amazon Elasticsearch 实例。下面是我的代码:
AWS4Signer signer = new AWS4Signer();
signer.setServiceName("es");
signer.setRegionName("us-east-1");
HttpRequestInterceptor interceptor = new AWSRequestSigningApacheInterceptor("es", signer, creds);
RestHighLevelClient EsClient = new RestHighLevelClient(RestClient.builder(new HttpHost("hostname.us-east-1.es.amazonaws.com",443,"https"))
.setHttpClientConfigCallback(httpAsyncClientBuilder -> HttpAsyncClientBuilder
.create()
.addInterceptorLast(interceptor)));
当我 运行 这段代码时,我看到了这个错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/script/mustache/SearchTemplateRequest
at Main.main(Main.java:194)
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.script.mustache.SearchTemplateRequest
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
这是在 EsClient
初始化时发生的。该错误表明缺少依赖项,但我的类路径中确实有 org.elasticsearch.script
。但是,它似乎没有 mustache.SearchTemplateRequest
。以下是我添加到项目中的相关依赖项:
不确定我在这里遗漏了什么。任何帮助,将不胜感激。谢谢。
我缺少以下罐子:
<!-- https://mvnrepository.com/artifact/org.elasticsearch.plugin/lang-mustache-client -->
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>lang-mustache-client</artifactId>
<version>7.6.2</version>
</dependency>
我还必须添加其他几个 jar 才能最终使其正常工作。
我正在尝试使用 java 程序中的 RestHighLevelClient
访问 Amazon Elasticsearch 实例。下面是我的代码:
AWS4Signer signer = new AWS4Signer();
signer.setServiceName("es");
signer.setRegionName("us-east-1");
HttpRequestInterceptor interceptor = new AWSRequestSigningApacheInterceptor("es", signer, creds);
RestHighLevelClient EsClient = new RestHighLevelClient(RestClient.builder(new HttpHost("hostname.us-east-1.es.amazonaws.com",443,"https"))
.setHttpClientConfigCallback(httpAsyncClientBuilder -> HttpAsyncClientBuilder
.create()
.addInterceptorLast(interceptor)));
当我 运行 这段代码时,我看到了这个错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/script/mustache/SearchTemplateRequest
at Main.main(Main.java:194)
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.script.mustache.SearchTemplateRequest
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
这是在 EsClient
初始化时发生的。该错误表明缺少依赖项,但我的类路径中确实有 org.elasticsearch.script
。但是,它似乎没有 mustache.SearchTemplateRequest
。以下是我添加到项目中的相关依赖项:
不确定我在这里遗漏了什么。任何帮助,将不胜感激。谢谢。
我缺少以下罐子:
<!-- https://mvnrepository.com/artifact/org.elasticsearch.plugin/lang-mustache-client -->
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>lang-mustache-client</artifactId>
<version>7.6.2</version>
</dependency>
我还必须添加其他几个 jar 才能最终使其正常工作。