elasticsearch 5.3.0 中的重大更改 java api
Breaking changes in elasticsearch 5.3.0 java api
我正在将我的 elasticsearch 从 2.3.4 升级到 5.3.0
下面是我的类路径中的 jar
elasticsearch-5.3.0.jar
HdrHistogram-2.1.6.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.3.0.jar
jna-4.2.2.jar
joda-time-2.9.5.jar
jopt-simple-5.0.2.jar
jts-1.13.jar
lucene-analyzers-common-6.4.1.jar
lucene-backward-codecs-6.4.1.jar
lucene-core-6.4.1.jar
lucene-grouping-6.4.1.jar
lucene-highlighter-6.4.1.jar
lucene-join-6.4.1.jar
lucene-memory-6.4.1.jar
lucene-misc-6.4.1.jar
lucene-queries-6.4.1.jar
lucene-queryparser-6.4.1.jar
lucene-sandbox-6.4.1.jar
lucene-spatial-6.4.1.jar
lucene-spatial-extras-6.4.1.jar
lucene-spatial3d-6.4.1.jar
lucene-suggest-6.4.1.jar
securesm-1.1.jar
snakeyaml-1.15.jar
t-digest-3.0.jar
transport-netty4-client-5.3.0.jar
percolator-client-5.3.0.jar
reindex-client-5.3.0.jar
lang-mustache-client-5.3.0.jar
transport-netty3-client-5.3.0.jar
transport-5.3.0.jar
log4j-api-2.7.jar
log4j-core-2.7.jar
log4j-1.2-api-2.7.jar
spatial4j-0.6.jar
当我在做
client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300))
我得到以下异常
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/logging/InternalLoggerFactory
at org.elasticsearch.transport.Netty3Plugin.<clinit>(Netty3Plugin.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:376)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:104)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:101)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:268)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:125)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:111)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:101)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
at org.codehaus.groovy.runtime.callsite.ConstructorSite.callConstructor(ConstructorSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.hire.test.HudkiES.openClient(HudkiES.groovy:146)
at org.hire.test.HudkiES.<init>(HudkiES.groovy:113)
at org.hire.test.HudkiES.<init>(HudkiES.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:81)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.hire.test.HudkiES.main(HudkiES.groovy:1020)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.logging.InternalLoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 37 more
Java 版本 1.8
是否有人也面临同样的问题或知道我在这里遗漏了什么?
Elasticsearch 5.3 期待 NettyPlugin 版本 4 org.elasticsearch.transport.Netty4Plugin
。您的类路径或两个版本中的版本很可能是错误的,而旧版本首先被抓取。
如果您为您的库生成依赖关系树,您会看到哪些版本被引入,然后可以 include/exclude right/wrong 版本。
我正在将我的 elasticsearch 从 2.3.4 升级到 5.3.0
下面是我的类路径中的 jar
elasticsearch-5.3.0.jar
HdrHistogram-2.1.6.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.3.0.jar
jna-4.2.2.jar
joda-time-2.9.5.jar
jopt-simple-5.0.2.jar
jts-1.13.jar
lucene-analyzers-common-6.4.1.jar
lucene-backward-codecs-6.4.1.jar
lucene-core-6.4.1.jar
lucene-grouping-6.4.1.jar
lucene-highlighter-6.4.1.jar
lucene-join-6.4.1.jar
lucene-memory-6.4.1.jar
lucene-misc-6.4.1.jar
lucene-queries-6.4.1.jar
lucene-queryparser-6.4.1.jar
lucene-sandbox-6.4.1.jar
lucene-spatial-6.4.1.jar
lucene-spatial-extras-6.4.1.jar
lucene-spatial3d-6.4.1.jar
lucene-suggest-6.4.1.jar
securesm-1.1.jar
snakeyaml-1.15.jar
t-digest-3.0.jar
transport-netty4-client-5.3.0.jar
percolator-client-5.3.0.jar
reindex-client-5.3.0.jar
lang-mustache-client-5.3.0.jar
transport-netty3-client-5.3.0.jar
transport-5.3.0.jar
log4j-api-2.7.jar
log4j-core-2.7.jar
log4j-1.2-api-2.7.jar
spatial4j-0.6.jar
当我在做
client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300))
我得到以下异常
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/logging/InternalLoggerFactory
at org.elasticsearch.transport.Netty3Plugin.<clinit>(Netty3Plugin.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:376)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:104)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:101)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:268)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:125)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:111)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:101)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
at org.codehaus.groovy.runtime.callsite.ConstructorSite.callConstructor(ConstructorSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.hire.test.HudkiES.openClient(HudkiES.groovy:146)
at org.hire.test.HudkiES.<init>(HudkiES.groovy:113)
at org.hire.test.HudkiES.<init>(HudkiES.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:81)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.hire.test.HudkiES.main(HudkiES.groovy:1020)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.logging.InternalLoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 37 more
Java 版本 1.8
是否有人也面临同样的问题或知道我在这里遗漏了什么?
Elasticsearch 5.3 期待 NettyPlugin 版本 4 org.elasticsearch.transport.Netty4Plugin
。您的类路径或两个版本中的版本很可能是错误的,而旧版本首先被抓取。
如果您为您的库生成依赖关系树,您会看到哪些版本被引入,然后可以 include/exclude right/wrong 版本。