Hi,
I am writing a java plugin which uses Mustache and NoClassDefFoundError exception is thrown by ElasticSearch, When I am trying to create an instance of class "MustacheScriptEngineService".
final ScriptEngineService engine = new MustacheScriptEngineService();
Elastic Search version :5.4.1
I am using maven and i have added following dependencies in pom.xml
org.elasticsearch.plugin
lang-mustache-client
5.4.1
Build succeeds but NoClassDefFoundError is thrown at runtime when i try to access java plugin.
ES stack trace:
java.lang.NoClassDefFoundError: org/elasticsearch/script/mustache/MustacheScriptEngineService
at com.microsoft.search.script.CreatePhraseSuggesterQuery.runAsDouble(CreatePhraseSuggesterQuery.java:76) ~[?:?]
at org.elasticsearch.script.AbstractDoubleSearchScript.run(AbstractDoubleSearchScript.java:30) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.aggregations.support.values.ScriptDoubleValues.setDocument(ScriptDoubleValues.java:46) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.MultiValueMode$5.pick(MultiValueMode.java:424) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.MultiValueMode$10.get(MultiValueMode.java:647) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.aggregations.metrics.max.MaxAggregator$1.collect(MaxAggregator.java:88) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.aggregations.LeafBucketCollector.collect(LeafBucketCollector.java:82) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.apache.lucene.search.MultiCollector$MultiLeafCollector.collect(MultiCollector.java:174) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:246) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:197) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:669) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:388) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:108) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:247) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:262) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:339) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:336) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:627) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-5.4.1.jar:5.4.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.4.1.jar:5.4.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_161]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.script.mustache.MustacheScriptEngineService
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_161]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_161]
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:814) ~[?:1.8.0_161]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_161]
Other plugins seems to work fine.
Am i missing something here? Do i need to add any other dependencies or configurations to use 'MustacheScriptEngineService'?
Thanks