ElasticSearch启动错误锦集

1.Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/common/transport/TransportAddress : Unsupported major.minor version 52.0

/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/bin/java -Didea.launcher.port=7532 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/JObjC.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Users/xp-od-m-2596/Documents/workspace/king/ElasticSearch-demo/target/classes:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/client/transport/5.6.3/transport-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/elasticsearch/5.6.3/elasticsearch-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-core/3.0.3/lucene-core-3.0.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-analyzers-common/6.6.1/lucene-analyzers-common-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-backward-codecs/6.6.1/lucene-backward-codecs-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-grouping/6.6.1/lucene-grouping-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-highlighter/6.6.1/lucene-highlighter-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-join/6.6.1/lucene-join-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-memory/6.6.1/lucene-memory-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-misc/6.6.1/lucene-misc-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-queries/6.6.1/lucene-queries-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-queryparser/6.6.1/lucene-queryparser-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-sandbox/6.6.1/lucene-sandbox-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial/6.6.1/lucene-spatial-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial-extras/6.6.1/lucene-spatial-extras-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial3d/6.6.1/lucene-spatial3d-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-suggest/6.6.1/lucene-suggest-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/securesm/1.1/securesm-1.1.jar:/Users/xp-od-m-2596/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.2/jopt-simple-5.0.2.jar:/Users/xp-od-m-2596/.m2/repository/com/carrotsearch/hppc/0.7.1/hppc-0.7.1.jar:/Users/xp-od-m-2596/.m2/repository/joda-time/joda-time/2.4/joda-time-2.4.jar:/Users/xp-od-m-2596/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.2.2/jackson-core-2.2.2.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.8.6/jackson-dataformat-smile-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.8.6/jackson-dataformat-yaml-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.8.6/jackson-dataformat-cbor-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/tdunning/t-digest/3.0/t-digest-3.0.jar:/Users/xp-od-m-2596/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/logging/log4j/log4j-api/2.3/log4j-api-2.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/jna/4.4.0-1/jna-4.4.0-1.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/transport-netty3-client/5.6.3/transport-netty3-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty/3.10.6.Final/netty-3.10.6.Final.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/transport-netty4-client/5.6.3/transport-netty4-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-buffer/4.1.13.Final/netty-buffer-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-codec/4.1.13.Final/netty-codec-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-codec-http/4.1.13.Final/netty-codec-http-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-common/4.1.13.Final/netty-common-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-handler/4.1.13.Final/netty-handler-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-resolver/4.1.13.Final/netty-resolver-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-transport/4.1.13.Final/netty-transport-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/reindex-client/5.6.3/reindex-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/5.6.3/elasticsearch-rest-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.2/httpasyncclient-4.1.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.5/httpcore-nio-4.4.5.jar:/Users/xp-od-m-2596/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/Users/xp-od-m-2596/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/lang-mustache-client/5.6.3/lang-mustache-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/com/github/spullara/mustache/java/compiler/0.9.3/compiler-0.9.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/percolator-client/5.6.3/percolator-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/parent-join-client/5.6.3/parent-join-client-5.6.3.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.king.test.elasticsearch.Test
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/common/transport/TransportAddress : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:188)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)

Process finished with exit code 1

JDK版本问题,升级为1.8解决

 

2.Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/util/SetOnce

/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Users/xp-od-m-2596/Documents/workspace/king/ElasticSearch-demo/target/classes:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/client/transport/5.6.3/transport-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/elasticsearch/5.6.3/elasticsearch-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-core/3.0.3/lucene-core-3.0.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-analyzers-common/6.6.1/lucene-analyzers-common-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-backward-codecs/6.6.1/lucene-backward-codecs-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-grouping/6.6.1/lucene-grouping-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-highlighter/6.6.1/lucene-highlighter-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-join/6.6.1/lucene-join-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-memory/6.6.1/lucene-memory-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-misc/6.6.1/lucene-misc-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-queries/6.6.1/lucene-queries-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-queryparser/6.6.1/lucene-queryparser-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-sandbox/6.6.1/lucene-sandbox-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial/6.6.1/lucene-spatial-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial-extras/6.6.1/lucene-spatial-extras-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial3d/6.6.1/lucene-spatial3d-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-suggest/6.6.1/lucene-suggest-6.6.1.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/securesm/1.1/securesm-1.1.jar:/Users/xp-od-m-2596/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.2/jopt-simple-5.0.2.jar:/Users/xp-od-m-2596/.m2/repository/com/carrotsearch/hppc/0.7.1/hppc-0.7.1.jar:/Users/xp-od-m-2596/.m2/repository/joda-time/joda-time/2.4/joda-time-2.4.jar:/Users/xp-od-m-2596/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.2.2/jackson-core-2.2.2.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.8.6/jackson-dataformat-smile-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.8.6/jackson-dataformat-yaml-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.8.6/jackson-dataformat-cbor-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/tdunning/t-digest/3.0/t-digest-3.0.jar:/Users/xp-od-m-2596/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/logging/log4j/log4j-api/2.3/log4j-api-2.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/jna/4.4.0-1/jna-4.4.0-1.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/transport-netty3-client/5.6.3/transport-netty3-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty/3.10.6.Final/netty-3.10.6.Final.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/transport-netty4-client/5.6.3/transport-netty4-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-buffer/4.1.13.Final/netty-buffer-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-codec/4.1.13.Final/netty-codec-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-codec-http/4.1.13.Final/netty-codec-http-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-common/4.1.13.Final/netty-common-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-handler/4.1.13.Final/netty-handler-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-resolver/4.1.13.Final/netty-resolver-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-transport/4.1.13.Final/netty-transport-4.1.13.Final.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/reindex-client/5.6.3/reindex-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/5.6.3/elasticsearch-rest-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.2/httpasyncclient-4.1.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.5/httpcore-nio-4.4.5.jar:/Users/xp-od-m-2596/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/Users/xp-od-m-2596/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/lang-mustache-client/5.6.3/lang-mustache-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/com/github/spullara/mustache/java/compiler/0.9.3/compiler-0.9.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/percolator-client/5.6.3/percolator-client-5.6.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/parent-join-client/5.6.3/parent-join-client-5.6.3.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.king.test.elasticsearch.Test
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/util/SetOnce
	at org.elasticsearch.common.settings.Settings$Builder.<init>(Settings.java:673)
	at org.elasticsearch.common.settings.Settings$Builder.<clinit>(Settings.java:668)
	at org.elasticsearch.common.settings.Settings.<clinit>(Settings.java:84)
	at com.king.test.elasticsearch.Test.main(Test.java:26)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.util.SetOnce
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 9 more

Process finished with exit code 1

增加lucene依赖

<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>6.6.0</version>
</dependency>

3. java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW

/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java -ea -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA 14.app/Contents/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Users/xp-od-m-2596/Documents/workspace/king/ElasticSearch-demo/target/classes:/Applications/IntelliJ IDEA 14.app/Contents/lib/junit-4.11.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/hamcrest-core-1.3.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/hamcrest-library-1.3.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-core/5.5.2/lucene-core-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/elasticsearch/5.5.2/elasticsearch-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-analyzers-common/6.6.0/lucene-analyzers-common-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-backward-codecs/6.6.0/lucene-backward-codecs-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-grouping/6.6.0/lucene-grouping-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-highlighter/6.6.0/lucene-highlighter-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-join/6.6.0/lucene-join-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-memory/6.6.0/lucene-memory-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-misc/6.6.0/lucene-misc-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-queries/6.6.0/lucene-queries-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-queryparser/6.6.0/lucene-queryparser-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-sandbox/6.6.0/lucene-sandbox-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial/6.6.0/lucene-spatial-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial-extras/6.6.0/lucene-spatial-extras-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-spatial3d/6.6.0/lucene-spatial3d-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/lucene/lucene-suggest/6.6.0/lucene-suggest-6.6.0.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/securesm/1.1/securesm-1.1.jar:/Users/xp-od-m-2596/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.2/jopt-simple-5.0.2.jar:/Users/xp-od-m-2596/.m2/repository/com/carrotsearch/hppc/0.7.1/hppc-0.7.1.jar:/Users/xp-od-m-2596/.m2/repository/joda-time/joda-time/2.4/joda-time-2.4.jar:/Users/xp-od-m-2596/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.2.2/jackson-core-2.2.2.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.8.6/jackson-dataformat-smile-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.8.6/jackson-dataformat-yaml-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.8.6/jackson-dataformat-cbor-2.8.6.jar:/Users/xp-od-m-2596/.m2/repository/com/tdunning/t-digest/3.0/t-digest-3.0.jar:/Users/xp-od-m-2596/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/logging/log4j/log4j-api/2.3/log4j-api-2.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/jna/4.4.0/jna-4.4.0.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/client/transport/5.5.2/transport-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/transport-netty3-client/5.5.2/transport-netty3-client-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty/3.10.6.Final/netty-3.10.6.Final.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/transport-netty4-client/5.5.2/transport-netty4-client-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-buffer/4.1.11.Final/netty-buffer-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-codec/4.1.11.Final/netty-codec-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-codec-http/4.1.11.Final/netty-codec-http-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-common/4.1.11.Final/netty-common-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-handler/4.1.11.Final/netty-handler-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-resolver/4.1.11.Final/netty-resolver-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/io/netty/netty-transport/4.1.11.Final/netty-transport-4.1.11.Final.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/reindex-client/5.5.2/reindex-client-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/client/rest/5.5.2/rest-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.2/httpasyncclient-4.1.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.5/httpcore-nio-4.4.5.jar:/Users/xp-od-m-2596/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/Users/xp-od-m-2596/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/lang-mustache-client/5.5.2/lang-mustache-client-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/com/github/spullara/mustache/java/compiler/0.9.3/compiler-0.9.3.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/percolator-client/5.5.2/percolator-client-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/elasticsearch/plugin/parent-join-client/5.5.2/parent-join-client-5.5.2.jar:/Users/xp-od-m-2596/.m2/repository/org/apache/logging/log4j/log4j-core/2.6.2/log4j-core-2.6.2.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 com.king.test.elasticsearch.EsTest,index
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW
	at org.elasticsearch.common.xcontent.json.JsonXContent.<clinit>(JsonXContent.java:77)
	at org.elasticsearch.common.xcontent.XContentType$1.xContent(XContentType.java:60)
	at org.elasticsearch.common.settings.Setting.arrayToParsableString(Setting.java:868)
	at org.elasticsearch.common.settings.Setting.lambda$listSetting$29(Setting.java:814)
	at org.elasticsearch.common.settings.Setting.<init>(Setting.java:131)
	at org.elasticsearch.common.settings.Setting.<init>(Setting.java:158)
	at org.elasticsearch.common.settings.Setting$2.<init>(Setting.java:814)
	at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:813)
	at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:796)
	at org.elasticsearch.common.network.NetworkService.<clinit>(NetworkService.java:48)
	at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:98)
	at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)
	at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:265)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:130)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:116)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:106)
	at com.king.test.elasticsearch.EsTest.before(EsTest.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)


Process finished with exit code 255

 

通过排查发现缺少jar包依赖

解决办法:新增依赖
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.6</version>
</dependency>

4.java.lang.NoSuchFieldError: LUCENE_5_5_4

java.lang.NoSuchFieldError: LUCENE_5_5_4
	at org.elasticsearch.Version.<clinit>(Version.java:85)
	at org.elasticsearch.common.io.stream.StreamOutput.<init>(StreamOutput.java:74)
	at org.elasticsearch.common.io.stream.BytesStream.<init>(BytesStream.java:24)
	at org.elasticsearch.common.io.stream.BytesStreamOutput.<init>(BytesStreamOutput.java:59)
	at org.elasticsearch.common.io.stream.BytesStreamOutput.<init>(BytesStreamOutput.java:56)
	at org.elasticsearch.common.io.stream.BytesStreamOutput.<init>(BytesStreamOutput.java:46)
	at org.elasticsearch.common.xcontent.XContentBuilder.builder(XContentBuilder.java:69)
	at org.elasticsearch.common.settings.Setting.arrayToParsableString(Setting.java:868)
	at org.elasticsearch.common.settings.Setting.lambda$listSetting$29(Setting.java:814)
	at org.elasticsearch.common.settings.Setting.<init>(Setting.java:131)
	at org.elasticsearch.common.settings.Setting.<init>(Setting.java:158)
	at org.elasticsearch.common.settings.Setting$2.<init>(Setting.java:814)
	at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:813)
	at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:796)
	at org.elasticsearch.common.network.NetworkService.<clinit>(NetworkService.java:48)
	at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:98)
	at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)
	at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:265)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:130)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:116)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:106)
	at com.king.test.elasticsearch.EsTest.before(EsTest.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

初步排查本地版本为5.5.2,直接升级到最高版本

<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>6.6.0</version>
</dependency>

5.NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{TjDxLSumQ5mSz9_Kxv7dcA}{192.168.51.129}{192.168.51.129:9300}]]

这个错误把我还苦了,当时看到es启动日志正常,但是客户端连接报错如上,通过提示信息一直以为是网络不通,或者客户端配置错误。

依据网上各种配置操作改了一遍又一遍,重启es的时候总是报错。还以为是服务冲突造成的。由于用的虚拟机错误信息无法看到全部内容所以也就忽略了错误信息的起始。实在无奈的情况下尝试通过nohup命令报错所有的错误信息,才发现了这个致命的提示。

java.lang.IllegalStateException: Received message from unsupported version: [5.5.2] minimal compatible version is: [5.6.0]
[2018-08-29T06:23:13,852][INFO ][o.e.t.TransportService   ] [node-1] publish_address {192.168.51.129:9300}, bound_addresses {192.168.51.129:9300}
[2018-08-29T06:23:13,872][INFO ][o.e.b.BootstrapChecks    ] [node-1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2018-08-29T06:23:16,969][INFO ][o.e.c.s.MasterService    ] [node-1] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {node-1}{yi_i_0mFQ4iQxb8fB4mO4A}{UY6hIw0mRECMKAxkzkGXOg}{192.168.51.129}{192.168.51.129:9300}
[2018-08-29T06:23:16,977][INFO ][o.e.c.s.ClusterApplierService] [node-1] new_master {node-1}{yi_i_0mFQ4iQxb8fB4mO4A}{UY6hIw0mRECMKAxkzkGXOg}{192.168.51.129}{192.168.51.129:9300}, reason: apply cluster state (from master [master {node-1}{yi_i_0mFQ4iQxb8fB4mO4A}{UY6hIw0mRECMKAxkzkGXOg}{192.168.51.129}{192.168.51.129:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2018-08-29T06:23:17,031][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-1] publish_address {192.168.51.129:9200}, bound_addresses {192.168.51.129:9200}
[2018-08-29T06:23:17,031][INFO ][o.e.n.Node               ] [node-1] started
[2018-08-29T06:23:17,040][INFO ][o.e.g.GatewayService     ] [node-1] recovered [0] indices into cluster_state
[2018-08-29T06:23:38,772][WARN ][o.e.t.n.Netty4Transport  ] [node-1] exception caught on transport layer [[id: 0xf99b7ce1, L:/192.168.51.129:9300 - R:/192.168.51.1:61015]], closing connection
java.lang.IllegalStateException: Received message from unsupported version: [5.5.2] minimal compatible version is: [5.6.0]
	at org.elasticsearch.transport.TcpTransport.ensureVersionCompatibility(TcpTransport.java:1415) ~[elasticsearch-6.0.0.jar:6.0.0]
	at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1362) ~[elasticsearch-6.0.0.jar:6.0.0]
	at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:60) ~[transport-netty4-6.0.0.jar:6.0.0]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [netty-codec-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:297) [netty-codec-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:413) [netty-codec-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) [netty-codec-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241) [netty-handler-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:544) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-common-4.1.13.Final.jar:4.1.13.Final]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

通过上面的信息已经很明确了,就是由于客户端的版本过低造成的问题。

解决办法:升级客户端版本

<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>6.0.0</version>
</dependency>

 

 

总结

前前后后版本报错无数,各种网站也没有查到完整版的jar包依赖,在此记录es的最小依赖,经测试无误,供大家参考

<dependencies>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>7.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>6.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>6.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.6.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.8.6</version>
        </dependency>
    </dependencies>

 

测试类

package com.king.test.elasticsearch;

import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.junit.Before;
import org.junit.Test;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
/**
 * 类名称: Test <br>
 * 类描述: <br>
 *
 * @author: hua.jin
 * @since: 2018/8/27 14:44
 * @version: 1.0.0
 */
public class EsTest {
	TransportClient client;

	private String IP = "192.168.51.129";

	@Before
	@SuppressWarnings({ "unchecked" })
	public void before() throws UnknownHostException, InterruptedException, ExecutionException {
		Settings esSettings = Settings.builder()
				.put("cluster.name", "elasticsearch") //设置ES实例的名称
				.put("client.transport.sniff", false) //自动嗅探整个集群的状态,把集群中其他ES节点的ip添加到本地的客户端列表中
				.build();
		client = new PreBuiltTransportClient(esSettings);//初始化client较老版本发生了变化,此方法有几个重载方法,初始化插件等。
		//此步骤添加IP,至少一个,其实一个就够了,因为添加了自动嗅探配置
		client.addTransportAddress(new TransportAddress(InetAddress.getByName(IP), 9300));
	}

	@Test
	public void index() throws Exception {
		Map<String,Object> infoMap = new HashMap<String, Object>();
		infoMap.put("name", "广告信息11");
		infoMap.put("title", "我的广告22");
		infoMap.put("createTime", new Date());
		infoMap.put("count", 1022);
		IndexResponse indexResponse = client.prepareIndex("test", "info","100").setSource(infoMap).execute().actionGet();
		System.out.println("id:"+indexResponse.getId());
	}

	@Test
	public void test() throws Exception {

		GetResponse response = client.prepareGet("test", "info", "100").execute().actionGet();
		System.out.println("response.getId():"+response.getId());
		System.out.println("response.getSourceAsString():"+response.getSourceAsString());
	}
}

 

最后的这一抹绿色太难得了

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页