修改Lucene源码,重新打包,替换elasticsearch中原有的Lucene-core.jar包,出现问题
Elasticsearch | 作者 elisha | 发布于2017年12月21日 | 阅读数:7625
(elasticsearch版本2.4.5,Lucene-core版本5.5.4)
修改Lucene源码(maven工程),重新打包,替换elasticsearch中原有的Lucene-core.jar包,出现以下错误:java.util.ServiceConfigurationError: Cannot instantiate SPI class: org.apache.lucene.codecs.lucene50.Lucene50Codec
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:82)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:51)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:38)
at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:47)
at org.apache.lucene.codecs.Codec.reloadCodecs(Codec.java:133)
at org.elasticsearch.plugins.PluginsService.reloadLuceneSPI(PluginsService.java:454)
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:430)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:115)
at org.elasticsearch.node.Node.<init>(Node.java:158)
at org.elasticsearch.node.Node.<init>(Node.java:140)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Caused by: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene50' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: [es090, completion090, XBloomFilter, Lucene40, Lucene41, IDVersion, completion]
at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:114)
at org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:112)
at org.apache.lucene.codecs.lucene50.Lucene50Codec.<init>(Lucene50Codec.java:155)
at org.apache.lucene.codecs.lucene50.Lucene50Codec.<init>(Lucene50Codec.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:72)
... 13 more
修改Lucene源码(maven工程),重新打包,替换elasticsearch中原有的Lucene-core.jar包,出现以下错误:java.util.ServiceConfigurationError: Cannot instantiate SPI class: org.apache.lucene.codecs.lucene50.Lucene50Codec
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:82)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:51)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:38)
at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:47)
at org.apache.lucene.codecs.Codec.reloadCodecs(Codec.java:133)
at org.elasticsearch.plugins.PluginsService.reloadLuceneSPI(PluginsService.java:454)
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:430)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:115)
at org.elasticsearch.node.Node.<init>(Node.java:158)
at org.elasticsearch.node.Node.<init>(Node.java:140)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Caused by: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene50' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: [es090, completion090, XBloomFilter, Lucene40, Lucene41, IDVersion, completion]
at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:114)
at org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:112)
at org.apache.lucene.codecs.lucene50.Lucene50Codec.<init>(Lucene50Codec.java:155)
at org.apache.lucene.codecs.lucene50.Lucene50Codec.<init>(Lucene50Codec.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:72)
... 13 more
1 个回复
Kalasearch
赞同来自:
Lucene里的lucene-suggest和elastic中的META-INF/services需要合并一下,如果你用的是Maven的话,请添加: 如果你用的是gradle的话,可以用shadowJar
请参考以下文章:
https://github.com/elastic/ela ... 15071
https://github.com/elastic/ela ... /3350