I am using Elasticsearch 6.5.4. I am using network location to store the ES setup and run elasticsearch.bat directly from there.
I have written a Java program to start ES and put a pipeline definition (via REST). it retries starting ES if first ES start gets failed.
When I start ES, sometimes, I get the following error. My program then retries to start it again. Second time, it works correctly.
[2019-03-06T13:34:19,784][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] fatal error in thread [elasticsearch[PC-***][management][T#1]], exiting
java.lang.NoClassDefFoundError: org/objectweb/asm/commons/Method
at org.elasticsearch.painless.ScriptClassInfo.(ScriptClassInfo.java:79) ~[?:?]
at org.elasticsearch.painless.Compiler.compile(Compiler.java:222) ~[?:?]
at org.elasticsearch.painless.PainlessScriptEngine$5.run(PainlessScriptEngine.java:423) ~[?:?]
at org.elasticsearch.painless.PainlessScriptEngine$5.run(PainlessScriptEngine.java:419) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_181]
at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:419) ~[?:?]
at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:170) ~[?:?]
at org.elasticsearch.script.ScriptService.compile(ScriptService.java:334) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.common.ScriptProcessor$Factory.create(ScriptProcessor.java:148) ~[?:?]
at org.elasticsearch.ingest.common.ScriptProcessor$Factory.create(ScriptProcessor.java:90) ~[?:?]
at org.elasticsearch.ingest.ConfigurationUtils.readProcessor(ConfigurationUtils.java:402) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.ConfigurationUtils.readProcessor(ConfigurationUtils.java:372) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.ConfigurationUtils.readProcessorConfigs(ConfigurationUtils.java:316) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.Pipeline.create(Pipeline.java:73) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.IngestService.validatePipeline(IngestService.java:361) ~[elasticsearch-6.5.4.jar:6.5.4]
Any update here please.
Please note that NoClassDefFound error occurs randomly for different-2 classes. Also, it is coming when I run ES from my local machine (not only network location).
The reason of doing it as we have a server which needs to fork out the elastic search on its own.
I simply use Java ProcessBuilder to run elasticsearch.bat. It runs perfectly almost every time. Above issue occurs rarely but I am not getting why would it occur?
We do this as we do not want any manual intervention by customer even to setup a service.
Consider it like a script which just invokes elasticsearch.bat separately. I am confused why ES would throw the NoClassDefFound error as whole setup/files are available to it. One thing is common in all the stacktraces that it originates from below line and ES gets crashed after this error. One thing to note that filebeat is also running at the same time and is continuously pushing the data to ES.
at org.elasticsearch.ingest.Pipeline.create(Pipeline.java:73) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.IngestService.validatePipeline(IngestService.java:361) ~[elasticsearch-6.5.4.jar:6.5.4]
Ok. Would be better maybe to start a Docker image instead but I understand it can be an issue.
I understood that but I cannot tell where the issue is without seeing what you are exactly doing (the whole code). There's more likely something wrong.
But you can always look at what this project is doing to launch elasticsearch from a Java class.
I am also using almost the same way to start/fork the ES instance, though I am not using maven.
I am launching:
elasticsearch.bat -d -p <pid_file_path> with important settings set in elasticsearch.yml file
There's nothing I can do I'm afraid.
If you find out the problem, please share here where the problem was coming from.
I can't see the code so I can just suspect that not all the files (librairies) are fully available on disk when the process starts. May be a write delay on Windows machine? Just try to add a pause before starting to see if it's getting better.
I will check further, but there is one strange thing.
After ES is started successfully, my Java code fire URL/_ingest/pipeline/ REST call to ES to populate the various pipelines.
In one of the case where error occurred, first above REST call was successful but while putting second pipeline, following error occurred (in ES logs) and ES gets crashed. If it was some lib missing issue, first pipeline call would have been failed too.
[2019-03-06T13:34:19,784][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] fatal error in thread [elasticsearch[PC-***][management][T#1]], exiting
java.lang.NoClassDefFoundError: org/objectweb/asm/commons/Method
at org.elasticsearch.painless.ScriptClassInfo.(ScriptClassInfo.java:79) ~[?:?]
at org.elasticsearch.painless.Compiler.compile(Compiler.java:222) ~[?:?]
at org.elasticsearch.painless.PainlessScriptEngine$5.run(PainlessScriptEngine.java:423) ~[?:?]
at org.elasticsearch.painless.PainlessScriptEngine$5.run(PainlessScriptEngine.java:419) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_181]
at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:419) ~[?:?]
at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:170) ~[?:?]
at org.elasticsearch.script.ScriptService.compile(ScriptService.java:334) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.common.ScriptProcessor$Factory.create(ScriptProcessor.java:148) ~[?:?]
at org.elasticsearch.ingest.common.ScriptProcessor$Factory.create(ScriptProcessor.java:90) ~[?:?]
at org.elasticsearch.ingest.ConfigurationUtils.readProcessor(ConfigurationUtils.java:402) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.ConfigurationUtils.readProcessor(ConfigurationUtils.java:372) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.ConfigurationUtils.readProcessorConfigs(ConfigurationUtils.java:316) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.Pipeline.create(Pipeline.java:73) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.IngestService.validatePipeline(IngestService.java:361) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.ingest.IngestService.putPipeline(IngestService.java:215) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.action.ingest.PutPipelineTransportAction$1.onResponse(PutPipelineTransportAction.java:86) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.action.ingest.PutPipelineTransportAction$1.onResponse(PutPipelineTransportAction.java:78) ~[elasticsearch-6.5.4.jar:6.5.4]
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.