Gradle grabs all of the required dependencies including the org.elasticsearch:elasticsearch:7.17.6.
Using the XContent component throws this stacktrace;
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/util/Version
at org.elasticsearch.common.xcontent.XContentElasticsearchExtension.getXContentWriters(XContentElasticsearchExtension.java:67)
at org.elasticsearch.xcontent.XContentBuilder.<clinit>(XContentBuilder.java:114)
at org.elasticsearch.xcontent.json.JsonXContent.contentBuilder(JsonXContent.java:38)
at org.elasticsearch.xcontent.XContentFactory.contentBuilder(XContentFactory.java:107)
at org.elasticsearch.xcontent.XContentFactory.jsonBuilder(XContentFactory.java:34)
I can see the package "org.apache.lucene.util" does indeed exist in the org.elasticsearch:elasticsearch:7.17.6 jar, but not the "Version" class.
Is there another dependency the documentation hasn't mentioned I should be including?
Many thanks.
I'm transitioning from the rest client where we are using the XContent component, my easiest first step is to simply switch out the client transport from REST to Java client.
Therefore for now I still need the XContent.
Oh and I do already have databind on the classpath.
Including lucene-core:8.11.1 seems to have gotten me over the hump for anyone else who happens to be doing anything like this in future. Whether this is the right thing to do or not, I don't know.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.