Solr云无法找到插件 - NoClassDefFoundError

时间:2017-06-24 00:03:31

标签: solr solrcloud solrconfig

我正在运行solr云群并使用自定义搜索组件 - request-sanitizer-component

配置:

Server count: 8
Shards: 16
Replication factor: 3
Max shards per node: 6

我在solrconfig.xml中定义了搜索组件:

<searchComponent runtimeLib="true" name="request-sanitizer" version="1" class="com.cominvent.solr.RequestSanitizerComponent"/>

我已按照solr guide中的步骤将插件jar上传到.system集合。

然后我使用带有此curl的config API将插件jar添加到我的集合中:

curl http://solr-220.soma.plos.org:8983/solr/50_2/config -H 'Content-type:application/json' -d '{
    "add-runtimelib": { "name":"request-sanitizer", "version":1 }
}'

然后我添加了搜索组件:

curl http://solr-220.soma.plos.org:8983/solr/50_2/config -H 'Content-type:application/json' -d '{
  "add-searchcomponent": {
    "name": "request-sanitizer",
    "runtimeLib": true,
    "class": "com.cominvent.solr.RequestSanitizerComponent",
    "sanitize": "rows=>50:50" }
}'

插件jar和搜索组件已添加到configoverlay.json的{​​{1}}:

http://solr-220.soma.plos.org:8983/solr/50_2/config/overlay

但是,当我尝试查询集合时,我得到以下异常:

{ "responseHeader":{ "status":0, "QTime":0}, "overlay":{ "znodeVersion":4, "runtimeLib":{"request-sanitizer":{ "name":"request-sanitizer", "version":1}}, "searchComponent":{"request-sanitizer":{ "name":"request-sanitizer", "runtimeLib":true, "class":"com.cominvent.solr.RequestSanitizerComponent", "sanitize":"rows=>50:50"}}}}

我的配置有什么问题?

备注

对于第一次尝试,我将jar放在SOLR_HOME / lib中。 这最初适用于具有少量分片的集群 - 集合创建会抛出相同的NoClassDefFoundError异常,但它们会在服务器重新启动后消失。

然而,当我增加到8个分片时,创建引发了相同的异常,从未创建过该集合。这就是我决定使用配置API的原因,但我也接受使用SOLR_HOME / lib的解决方案。如果可能的话,一种可能性就是强制保留集合,即使有很多启动错误。

感谢阅读!

1 个答案:

答案 0 :(得分:0)

我们在类路径中有两个request-sanitizer jar实例。移除其中一个罐子解决了这个问题。