2017-06-24 58 views
1

我正在運行solr雲集羣並使用自定義搜索組件 - request-sanitizer-componentSolr雲無法找到插件 - NoClassDefFoundError

配置:

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步驟。

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和搜索組件添加到

我那麼插件JAR使用config API這個捲曲添加到我的收藏configoverlay.json at 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"}}}} 

然而,當我嘗試查詢集合,我得到以下異常:

java.lang.NoClassDefFoundError: org/apache/solr/handler/component/SearchComponent

有什麼不對我的配置?

對於第一嘗試我放置在罐中SOLR_HOME/lib中。 這最初適用於具有少量碎片的集羣 - 集合創建會拋出相同的NoClassDefFoundError異常,但是它們在服務器重新啓動後會消失。

但是,當我增加到8個碎片時,創建拋出異常集合從未創建。這就是我決定使用config API的原因,但我也會接受使用SOLR_HOME/lib的解決方案。如果可能的話,一種可能性是強制收集繼續存在,即使有大量啓動錯誤。

感謝您的閱讀!

回答

0

我們在classpath中有兩個request-sanitizer jar實例。卸下其中一個罐子解決了問題。