Solr cloud cannot find plugin - NoClassDefFoundError

307 Views Asked by At

I'm running a solr cloud cluster and using a custom search component - request-sanitizer-component.

config:

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

I've defined the search component in solrconfig.xml:

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

I have uploaded the plugin jar to the .system collection, following the steps in the solr guide.

I then add the plugin jar to my collection using the config API with this curl:

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 }
}'

Then I add the search component:

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" }
}'

The plugin jar and search component are added to 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"}}}}

However, when I try to query the collection, I get the following exception:

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

What is wrong with my configuration?

Notes

For the 1st attempt I placed the jar in SOLR_HOME/lib. This worked initially for clusters with a small number of shards - collection creation would throw the same NoClassDefFoundError exceptions, but they would disappear after a server restart.

However, when I increased to 8 shards, the creation threw the same exceptions and the collection was never created. This is why I decided to use the config API, but I would also accept a solution that uses SOLR_HOME/lib. One possibility is to force the collection to remain, even with numerous startup errors, if that is possible.

Thanks for reading!

1

There are 1 best solutions below

0
On

We had two instances of the request-sanitizer jar in the classpath. Removing one of the jars solved the problem.