# Mustache throwing NoClassDefFoundError

**URL:** <https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356>\
**Category:** Elasticsearch\
**Created:** [April 17, 2018, 12:49pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356 "2018-04-17T12:49:04Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 17, 2018, 12:49pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/1 "2018-04-17T12:49:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 18, 2018, 7:06am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/2 "2018-04-18T07:06:38Z")

</div>

Hey,

I am not a hundred percent sure how this has happened, without seeing more of the code/build process.

Have you considered using the `ScriptService` just create a mustache based `Script` und use the service for compilation?

--Alex

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 18, 2018, 9:36am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/3 "2018-04-18T09:36:09Z")

</div>

Thanks for the reply. I tried looking into ScriptService but couldnt find anything relevant to my issue.  
Could you please give a example or point me to some documentation/code?

What i am essentially trying to achieve here is:  
I want to use inline for Phrase suggester collate query. but due to security reasons we have disabled inline, hence i am trying to write a native java plugin for the same.  
Is this the correct approach?  
Is there any other way to achieve this without enabling script.inline?

Any insights regarding this will be really helpful.

Thanks

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 18, 2018, 10:04am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/4 "2018-04-18T10:04:02Z")

</div>

Hey,

I haven't tested it, but you could try out setting the `template` script context to be allowed, see [https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting-security.html#allowed-script-contexts-setting](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting-security.html#allowed-script-contexts-setting)

--Alex

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 18, 2018, 10:21am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/5 "2018-04-18T10:21:52Z")

</div>

I was talking about 6.x functionality here, misread that you are using 5.x. Sorry for the confusion.

Not sure if you want to enable `script.engine.mustache.inline: true`

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 18, 2018, 10:33am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/6 "2018-04-18T10:33:32Z")

</div>

Thanks. But, No. I dont want to enable inline scripts.  
In that case, is there any alternative to use collate queries for Phrase suggester?

Also, can i use native scripts in collate queries?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 18, 2018, 12:22pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/7 "2018-04-18T12:22:12Z")

</div>

you should be able to do sth like this

```auto
        "collate": {
          "query": {
            "lang" : "what_ever_your_script_engine_implements",
            "source" : "my_scripting_code"
          },

```

see [https://www.elastic.co/guide/en/elasticsearch/reference/5.5/modules-scripting-engine.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/modules-scripting-engine.html)

native scripts have been removed in 6.x in favor of custom script engines

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 20, 2018, 12:49pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/8 "2018-04-20T12:49:44Z")

</div>

Hi,

Thanks a lot for your suggestion. I tried above collate query and it works fine.  
I would still need to take a dependency on MustacheScriptEngineService class, which is again throwing 'NoClassDefFoundError'.

I want to refer this service in my plugin and i am using maven for the build process.  
Following is the details of the dependecies:  
lang-mustache-5.4.1 : located at ES\elasticsearch-5.4.1\modules\lang-mustache  
lang-mustache- **client** -5.4.1 : located at maven classpath (.m2\repository\org\elasticsearch\plugin\lang-mustache-client\5.4.1)

pom.xml includes the mustache dependency as mentioned earlier. Build is successful but i am running into 'NoClassDefFoundError' exception.  
Please let me know if i am missing any dependencies or config.  
Any suggestions to fix this issue would be really helpful.

Thanks

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [April 20, 2018, 6:46pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/9 "2018-04-20T18:46:56Z")

</div>

The client lib in this case is just a copy of lang-mustache with a different name (with the eventual intention to limit the client to only those classes needed by the transport client).

How did you install elasticsearch and how are you starting it?

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 23, 2018, 6:18am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/10 "2018-04-23T06:18:13Z")

</div>

So then both jar would contain the class 'MustacheScriptEngineService'.?  
Then i am not clear why is it throwing theexception at runtime?  
I downloaded windows 64bit ES 5.4.1 zip file , unzipped it and just running the elasticsearch.bat file.

Thanks,  
Ishita

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [April 23, 2018, 7:06am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/11 "2018-04-23T07:06:07Z")

</div>

What are all the jar files you have on the classpath for your client?

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 23, 2018, 10:06am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/12 "2018-04-23T10:06:11Z")

</div>

Do you mean lib folder of Elasticsearch?

Following is the list of jars present in lib folder

```
elasticsearch-5.4.1.jar           
HdrHistogram-2.1.9.jar            
hppc-0.7.1.jar                    
jackson-core-2.8.6.jar            
jackson-dataformat-cbor-2.8.6.jar 
jackson-dataformat-smile-2.8.6.jar
jackson-dataformat-yaml-2.8.6.jar                   
java-version-checker-5.4.1.jar    
jna-4.4.0.jar                     
joda-time-2.9.5.jar               
jopt-simple-5.0.2.jar             
jts-1.13.jar                      
log4j-1.2-api-2.8.2.jar           
log4j-api-2.8.2.jar               
log4j-core-2.8.2.jar              
lucene-analyzers-common-6.5.1.jar 
lucene-backward-codecs-6.5.1.jar  
lucene-core-6.5.1.jar             
lucene-grouping-6.5.1.jar         
lucene-highlighter-6.5.1.jar      
lucene-join-6.5.1.jar             
lucene-memory-6.5.1.jar           
lucene-misc-6.5.1.jar             
lucene-queries-6.5.1.jar          
lucene-queryparser-6.5.1.jar      
lucene-sandbox-6.5.1.jar          
lucene-spatial-6.5.1.jar          
lucene-spatial-extras-6.5.1.jar   
lucene-spatial3d-6.5.1.jar        
lucene-suggest-6.5.1.jar          
securesm-1.1.jar                  
snakeyaml-1.15.jar                
spatial4j-0.6.jar                 
t-digest-3.0.jar                  

```

I tried adding lang-mustache-5.4.1/lang-mustache-client-5.4.1 in lib folder which gave "jar hell" error.  
Also i couldn't remove this jar from Modules folder, because otherwise Elasticsearch wont start successfully.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [April 23, 2018, 7:57pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/13 "2018-04-23T19:57:49Z")

</div>

I mean the jars for your application. Can you confirm you:

1. Start elasticsearch using `bin/elasticsearch`
2. Start your user application with the elasticsearch transport client jar (+ transitive dependencies) and mustache client jar (+ transitive dependencies)
3. Connect to the elasticsearch service by creating a transport client, configured to the service you started in step 1

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 24, 2018, 6:06am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/14 "2018-04-24T06:06:09Z")

</div>

Hi,

I think i am listening to transport client only via IntelliJ.

D:\OldES\elasticsearch-5.4.1\bin\>.\elasticsearch.bat  
**Listening for transport dt\_socket at address:** 5005  
[2018-04-24T11:19:12,502][INFO][o.e.n.Node] [] initializing ...  
[2018-04-24T11:19:12,618][INFO][o.e.e.NodeEnvironment] [YYBkre7] using [1] data paths, mounts [[DATADRIVE1 (D:)]], net usable\_space [1.6tb], net total\_space [1.8tb], spins? [unknown], types [NTFS]  
[2018-04-24T11:19:12,618][INFO][o.e.e.NodeEnvironment] [YYBkre7] heap size [1.9gb], compressed ordinary object pointers [true]  
[2018-04-24T11:19:13,972][INFO][o.e.n.Node] node name [YYBkre7] derived from node ID [YYBkre7ERAuSjfLmM1yk7w]; set [node.name] to override  
[2018-04-24T11:19:13,973][INFO][o.e.n.Node] version[5.4.1], pid[23836], build[2cfe0df/2017-05-29T16:05:51.443Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0\_161/25.161-b12]  
[2018-04-24T11:19:14,034][INFO][o.e.n.Node] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -agentlib:jdwp=transport=dt\_socket,server=y,suspend=n,address=5005, -Delasticsearch, -Des.path.home=D:\OldES\elasticsearch-5.4.1]  
[2018-04-24T11:19:15,761][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [aggs-matrix-stats]  
[2018-04-24T11:19:15,762][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [ingest-common]  
[2018-04-24T11:19:15,762][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [lang-expression]  
[2018-04-24T11:19:15,762][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [lang-groovy]  
[2018-04-24T11:19:15,762][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [lang-mustache]  
[2018-04-24T11:19:15,763][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [lang-painless]  
[2018-04-24T11:19:15,763][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [percolator]  
[2018-04-24T11:19:15,764][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [reindex]  
[2018-04-24T11:19:15,764][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [transport-netty3]  
[2018-04-24T11:19:15,764][INFO][o.e.p.PluginsService] [YYBkre7] loaded module [transport-netty4]  
[2018-04-24T11:19:15,765][INFO][o.e.p.PluginsService] [YYBkre7] loaded plugin [AlmSearchPlugin]  
[2018-04-24T11:19:17,785][INFO][o.e.d.DiscoveryModule] [YYBkre7] using discovery type [zen]  
[2018-04-24T11:19:18,227][WARN][o.e.c.u.IndexFolderUpgrader] [D:\OldES\elasticsearch-5.4.1\data\nodes\0\indices\FBcUdCTwSaCrm46WlkHhww] no index state found - ignoring  
[2018-04-24T11:19:18,228][WARN][o.e.c.u.IndexFolderUpgrader] [D:\OldES\elasticsearch-5.4.1\data\nodes\0\indices\Upt94CD6Saipvah\_xcDYKQ] no index state found - ignoring  
[2018-04-24T11:19:18,247][WARN][o.e.c.u.IndexFolderUpgrader] [D:\OldES\elasticsearch-5.4.1\data\nodes\0\indices\skUK7KPLQ4uHoGFwKQfc7Q] no index state found - ignoring  
[2018-04-24T11:19:18,269][WARN][o.e.c.u.IndexFolderUpgrader] [D:\OldES\elasticsearch-5.4.1\data\nodes\0\indices\NwPvPs9MSwmcS\_v9J3r8Ng] no index state found - ignoring  
[2018-04-24T11:19:18,270][WARN][o.e.c.u.IndexFolderUpgrader] [D:\OldES\elasticsearch-5.4.1\data\nodes\0\indices\bhdl-mqLSly-kdwvTo0vPQ] no index state found - ignoring  
[2018-04-24T11:19:18,448][INFO][o.e.n.Node] initialized  
[2018-04-24T11:19:18,449][INFO][o.e.n.Node] [YYBkre7] starting ...  
[2018-04-24T11:19:18,869][INFO][o.e.t.TransportService] [YYBkre7] publish\_address {127.0.0.1:9300}, bound\_addresses {127.0.0.1:9300}, {[::1]:9300}  
[2018-04-24T11:19:21,923][INFO][o.e.c.s.ClusterService] [YYBkre7] new\_master {YYBkre7}{YYBkre7ERAuSjfLmM1yk7w}{o-ocAz7\_SyyG5i\_kuzsIwg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)  
[2018-04-24T11:19:22,104][INFO][o.e.h.n.Netty4HttpServerTransport] [YYBkre7] publish\_address {127.0.0.1:9200}, bound\_addresses {127.0.0.1:9200}, {[::1]:9200}  
[2018-04-24T11:19:22,107][INFO][o.e.n.Node] [YYBkre7] started

And later i am attaching the debugger to the service started in step 1

I am not very sure what do you mean by step 2.  
Could you please clarify?

Thanks,  
Ishita

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [April 26, 2018, 1:08pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/15 "2018-04-26T13:08:10Z")

</div>

Hi,

I was able to figure out a workaround for this issue.

If i delete the **"lang-mustache" folder** inside "modules" and place the required jar file (lang-mustache-client-5.4.1) in lib folder, then i was able to successfully create a instance of **MustacheScriptEngineService** class and use it.

This is definitely not a valid solution.  
Also, i am not able to understand why was i able to refer a dependency present in "lib" folder and not from "lang-mustache"?

Any help solving this issue would be really appreciated!

Thanks

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [May 20, 2018, 8:01pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/16 "2018-05-20T20:01:56Z")

</div>

Sorry for the delayed reply.

Why are you trying to construct MustacheScriptEngineService? This class is used internally by plugin initialization, but that is not how to use mustache from a client.

Looking back at the original issue here, it looks like you are trying to write a plugin (sorry I missed this before). You should not be using a transport client. Instead, your plugin needs to use the ScriptService to compile a script, and then execute it using the script apis.

---

<div class="post-metadata">

**Author:** ![ishim](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@ishim](https://discuss.elastic.co/u/ishim)\
**Post date:** [May 21, 2018, 11:22am UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/17 "2018-05-21T11:22:04Z")

</div>

Hi,  
I couldnt find a way where i can leverage mustache template language by using ScriptService.  
Could you please point me to an example or any document/discussion ?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [May 21, 2018, 5:02pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/18 "2018-05-21T17:02:48Z")

</div>

Are you trying to use mustache within some new api your plugin adds? If so, you need to create ScriptContext, or use an existing one. I need more information before I can give an example how to use the script service.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 18, 2018, 5:02pm UTC](https://discuss.elastic.co/t/mustache-throwing-noclassdeffounderror/128356/19 "2018-06-18T17:02:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
