Hi, I'm trying to use the High Level Java REST client version 6.0.0, in an IntelliJ plugin that I'm developing, but my progress is blocked, because when trying to create an instance of RestHighLevelClient, I get
java.lang.ExceptionInInitializerError....Caused by: java.lang.NullPointerException at org.elasticsearch.Build.(Build.java:49). My scala code:
_elastic = new RestHighLevelClient(
RestClient.builder(
new HttpHost("localhost", 9300, "http")))
Stack trace:
java.lang.ExceptionInInitializerError
at org.elasticsearch.common.logging.DeprecationLogger.(DeprecationLogger.java:163)
at org.elasticsearch.common.ParseField.(ParseField.java:35)
at org.elasticsearch.client.RestHighLevelClient.lambda$getDefaultNamedXContents$46(RestHighLevelClient.java:612)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1691)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.elasticsearch.client.RestHighLevelClient.getDefaultNamedXContents(RestHighLevelClient.java:613)
at org.elasticsearch.client.RestHighLevelClient.(RestHighLevelClient.java:207)
at org.elasticsearch.client.RestHighLevelClient.(RestHighLevelClient.java:192)
at org.elasticsearch.client.RestHighLevelClient.(RestHighLevelClient.java:184)
at [my plugin's stack]
at com.intellij.openapi.application.TransactionGuardImpl$6.run(TransactionGuardImpl.java:291)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:326)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:310)
... [More IntelliJ/AWT stack]
Caused by: java.lang.NullPointerException
at org.elasticsearch.Build.(Build.java:49)
... 117 more
My best guess is it has to do with weird class loader situations, as was the case with the problem reported using it with Jetty ? I know IntelliJ plugins get their own class loader...
Any workaround in the meantime?